2

I'm very new to Rails (and Ruby), and am having trouble installing and using gems. I'm trying to use ruby-tmdb (https://github.com/aarongough/ruby-tmdb) and there's very little documentation.

"sudo gem install ruby-tmdb" runs just fine and I can see the gem installed when I run "gem list --local"

But, when I try and run the app, I get the error "no such file to load -- ruby-tmdb".

I'm on Mac OS X Snow Leopard. Ruby 1.8.7. Rails 3.0.3. Gem 1.3.7.

2 Answers 2

3

Is the gem listed in your Gemfile? In Rails 3, all gem dependencies should be listed in the Gemfile, so that it is properly loaded when the app runs.

You should have something like the following line:

gem 'ruby-tmdb' 

Then, run bundle install to ensure that all gem dependencies are installed, and to have Bundler save the lock file that will ensure that all copies of this application run with the same gem versions. From this point on, you will no longer have to write the require line yourself; Rails will load in all necessary gems as the environment loads.

You might get the same error even after this, but it's always worth going through the standard process to help narrow things down :)

Sign up to request clarification or add additional context in comments.

1 Comment

Perfect! Thank you. I guess a lot of the tutorials are outdated since Rails seems to change so much version to version.
0

$ sudo which gem $ which gem $ sudo ruby -v $ ruby -v

Sometimes users have different gems and rubys compared to root.

A common problem is that a gem installed for ruby 1.8 by root isn't visible for the users ruby 1.9

gems for ruby 1.8 and gems for 1.9 are NOT compatible.

This probably isn't the issue but is something that may be worth considering.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.