5

I'm having trouble using newly installed gems - I think there must be something I'm missing, because I ran across the same error with both fb_graph and koala. I added the gem to my gemfile and then bundle installed it. I thought that was all you had to do, so I then tried using commands demonstrated in their respective wikis on github to see if they would work for me.

In the case of Koala, I added the line @graph = Koala::Facebook::GraphAPI.new to my Pages controller which displays pages#home. I got the error uninitialized constant PagesController::Koala.

In the case of FB_Graph, I added the line user = FbGraph::User.me(ACCESS_TOKEN) and got the error uninitialized constant PagesController::FBGraph.

Clearly I'm not doing something right - maybe there's something about configuring gems I installed that I'm missing - not really sure. I've never really messed around with the FB API before, so it's possible the error is specifically related to FB gems. Please advise.

Kvass
  • 8,294
  • 12
  • 65
  • 108

2 Answers2

5

Try

gem install koala

gem install fb_graph

first

and restart your rails server and it should now have it.

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • 3
    solved the issue - I think it was mostly that I forgot to restart the rails server so I was running a previous one before I had installed the gem. – Kvass Mar 31 '12 at 22:20
3

You probably need to require the gem. Add these to the top of your controller.

require "koala"

require "fbgraph"

amit_saxena
  • 7,450
  • 5
  • 49
  • 64