DeviseとOmniauth使ってFacebook/Twitterログインの出来るサイトを作成しております。
ログイン・サインインは何とか実装できたのですが、サインアウトすると以下のようなエラーメッセージとなってしまいます。
ログを見るとこのようなものが出ております。Routingの問題となっているようです。
FATAL -- : ActionController::RoutingError (No route matches [GET] "/en/users/sign_out"): actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app' railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
Route.rb はこちらです。
ruby
1devise_for :users, skip: [:session, :password, :registration], controllers: { omniauth_callbacks: "users/omniauth_callbacks" } 2 3 4 # Locale Information 5scope "(:locale)", locale: /en|ja/ do 6 get '/' => 'frontpage#index' 7 get 'restaurant/' => 'restaurant#index' 8 get 'restaurant/:id' => 'restaurant#show' 9 get 'menu/' => 'menu#index' 10 get 'menu/:id' => 'menu#show' 11 get 'area/' => 'area#index' 12 get 'area/:id' => 'area#show' 13 14 devise_for :users, skip: [:omniauth_callbacks] 15end 16
該当するViewファイルはこのようになっております。
他に何か必要な設定があったりしますでしょうか?
ruby
1<p class=""> 2<% if user_signed_in? %> 3 Logged in as <strong><%= current_user.email %></strong>. 4 <%= link_to 'Edit profile', edit_user_registration_path, :class => 'navbar-link' %> | 5 <%= link_to "Logout", destroy_user_session_path, :class => 'navbar-link' %> 6<% else %> 7 <%= link_to "Sign up", new_user_registration_path, :class => 'navbar-link' %> | 8 <%= link_to "Login", new_user_session_path, :class => 'navbar-link' %> 9<% end %> 10
どうかよろしくお願いします。
あなたの回答
tips
プレビュー