路由错误:未初始化的常量Users :: OmniauthCallbacksController

时间:2013-11-05 09:42:50

标签: ruby-on-rails facebook devise ruby-on-rails-4 omniauth

我使用rails4创建应用程序,使用devise和omniauth尝试facebook集成。 我最初登录facebook登录并验证凭证,在回调后重定向到我的应用程序并通过

  

路由错误:未初始化的常量   用户:: OmniauthCallbacksController

我展示了与设计fb相关的代码

配置/ intializers / devise.rb

require "omniauth-facebook"
  config.secret_key = 'ef8c3900aebe5cc02feb1dfafb084b2ed35412b43b9424315ac192336f3d16389449739f9a4d451621a912be899af0b9d1ce66fde56487e7edda30ba3997a2cd'
  config.omniauth :facebook, '############', '######################', :strategy_class => OmniAuth::Strategies::Facebook

配置/ routes.rb中     devise_for:用户,控制器:{omniauth_callbacks:“users / omniauth_callbacks”}

  devise_scope :user do
    get 'sign_in', :to => 'devise/sessions#new'
    get 'sign_out', :to => 'devise/sessions#destroy'
    root to: "devise/sessions#new"
  end

和我的view / layout / application.html.erb(对于fb脚本)

<div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        // init the FB JS SDK
        FB.init({
          appId      : '##########',                        // App ID from the app dashboard
          channelUrl : 'http://localhost:3000/channel.html', // Channel file for x-domain comms
          status     : true,                                 // Check Facebook Login status
          xfbml      : true                                  // Look for social plugins on the page
        });


        // Additional initialization code such as adding Event Listeners goes here
      };

      // Load the SDK asynchronously
      (function(d, s, id){
         var js, fjs = d.getElementsByTagName(s)[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement(s); js.id = id;
         js.src = "//connect.facebook.net/en_US/all.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
    </script>

我尝试了很多次,但我得到了同样的错误,请为这个问题提供有价值的解决方案

提前致谢。

0 个答案:

没有答案