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.

有帮助吗?

解决方案

Try

gem install koala

gem install fb_graph

first

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

其他提示

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

require "koala"

require "fbgraph"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top