Search code examples
ruby-on-railswindows-7rubygemsflickr

Ruby on Rails - doesn't recognise gem - installation issue?


I'm just trying to build an app on rails to do a simple search on flickr. Unfortunately, before I can do anything remotely interesting, it doesn't seem to recognise the 'flickr' gem I installed. As a simple test, all I did was to generate a controller called flickr with a method called flickrsearch. In that method, all I put in there is

    require 'flickr'

but in the browser, I have the following error:

    cannot load such file -- flickr

In fact, I originally wanted to require 'flickr' in config/environment.rb but the server wouldn't even fire up. It gave me errors saying it couldn't load flickr. I've tried it with other installed gems as well but same result.

A month ago when I first played around with Ruby, I installed Ruby and some gems as well. Everything worked fine...but recently, I installed Rails using Railsinstaller on http://railsinstaller.org/ (I use Windows 7). So I'm guessing it's looking in the wrong place for gems.

So it looks like I originally had gems in c:\Ruby193 and now I also have gems in c:\RailsInstaller\Ruby1.9.3

So...I decided to delete the whole c:\Ruby193 in a moment of madness...I know, probably not the cleanest way to do it.

Then reinstalled the flickr gem (gem install flickr). This time, it actually create the gem files for flickr in c:\RailsInstaller\Ruby1.9.3. Which is what I expected but I'm still having the problem of Rails not recognising the flickr gem.

Please help...Many thanks. Sam


Solution

  • You should not have to explicitly require gems in Rails. Just make sure you've added the flickr gem to your Gemfile and you've run the bundle install command.