通过使用考拉宝石在轨道上使用ruby进行Facebook集成

时间:2012-01-20 16:04:05

标签: ruby-on-rails koala

我希望在Koala的帮助下将facebook登录集成到rails项目上的ruby。我按照http://udooz.net/blog/2011/02/facebook-app-using-rails-koala/指定的教程链接进行了操作。但是在安装了考拉宝石后,它没有显示捆绑列表。甚至如果我运行rails服务器它会给我以下类型的错误消息:

C:/sample/facebook/config/initializers/koala.rb:10:in `<top (required)>': uninitialized constant Koala (NameError)
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
        from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from C:/sample/facebook/config/environment.rb:5:in `<top (required)>'
        from C:/sample/facebook/config.ru:4:in `require'

1 个答案:

答案 0 :(得分:0)

我通过评论

来解决这个问题
config.action_controller.allow_forgery_protection = false
config.gem "koala"

来自我的config / environment.rb文件

但是现在当我点击使用facebook链接登录oauth时,我从Devise那里得到“Csrf detected”错误。

你有这个工作吗?