Lucy Weatherford
Lucy Weatherford

Reputation: 5534

Rails locations - where do I locate a gem

In Rails -

Where should I locate Gems? I downloaded bootstrap and it's working, as well as a sample Rails app, separately, but I want them to work together. There is a bootstrapped rails gem (http://rubygems.org/gems/bootstrapped-rails) which I downloaded, but I'm unsure as to where I should locate it. Under models? And how do I make sure I am referring to it? I need to add something in controller as well?

Upvotes: 0

Views: 996

Answers (3)

meesern
meesern

Reputation: 2656

Again, more an answer to the question in the title than to what was intended by the questioner but you can use

bundle show <gemname>

To locate the directory where a gem is installed.

Upvotes: 2

AdamT
AdamT

Reputation: 6485

To answer the question in the title, you can locate your gems by running gem env in the console. That will give you the specific information about your "RubyGems Environment:" When you run gem install some_gem_name it will add this gem to your system.

However, what it sounds like your trying to do is add a gem to your app. If this is the case you add gems to a rails application's Gemfile.

So using your example, you'd locate your Gemfile and add the following:

gem "bootstrapped-rails", "~> 2.0.8.5"

Once that's done, you run bundle install in your terminal.

I find that a good resource for basic rails information can be found here: http://guides.rubyonrails.org/getting_started.html The tutorial is short and it will give you a great starting point.

Upvotes: 1

Magnuss
Magnuss

Reputation: 2310

As Dfr mentioned: https://github.com/seyhunak/twitter-bootstrap-rails

Twitter bootstrap isn't anything more than (mostly) a collection of css/js/image files.

Add this to your gemfile

gem "twitter-bootstrap-rails"

run

bundle install

run for simple css

rails generate bootstrap:install static

It should place relevant js and css files into your application.js and application.css files accordingly. (Read more about asset pipeline)

To get you started, in the gem's link under section - "Generating layouts and views", you can see rake tasks to generate sample layouts.

e.g.

rails g bootstrap:layout application fixed

You should now have a twitter-bootstraped application.html.erb file under views/layouts.

Upvotes: 1

Related Questions