Ruby on Rails:无法在生产中退出应用程序 [英] Ruby on Rails: Unable to sign out of application in production
问题描述
你正在寻找的页面不存在你可能错误地址或页面可能已经移动了,如果您是应用程序所有者,请查阅日志以获取更多信息。
对于用户验证,我使用的是设计宝石,我有多个解决方案堆栈溢出,但没有一个为我工作。看看下面的文件。
Heroku日志:
2014-10-04T18:17:49.022165 + 00:00 app [web.1]:在2014-10-04 18:17:49开始GET/ users / sign_out为66.65.108.74 +0000
2014 -10-04T18:17:49.027680 + 00:00 app [web.1]:
2014-10-04T18:17:49.027702 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1 .0 / gems / railties-4.1.5 / lib / rails / rack / logger.rb:20:在`block in call'
2014-10-04T18:17:49.027684 + 00:00 app [web。 1]:ActionController :: RoutingError(没有路由匹配[GET]/ users / sign_out):
2014-10-04T18:17:49.027686 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / actionpack-4.1.5 / lib / action_dispatch / middleware / debug_exceptions.rb:21:在`call'
2014-10-04T18:17:49.027699 + 00:00 app [web .1]:vendor / bundle / ruby / 2.1.0 / gems / actionpack-4.1.5 / lib / action_dispatch / middleware / show_exceptions.rb:30:在`call'
2014-10-04T18:17: 49.027701 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / railties-4.1.5 / lib / rails / rack / logger.rb:38:在`call_app
2014-10-04T18:17:49.027704 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / activesupport-4.1.5 / lib / active_support / tagged_logging.rb: 68:在`block in tagged'
2014-10-04T18:17:49.027711 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / rack-1.5.2 / lib / rack / runtime.rb:17:在`call'
2014-10-04T18:17:49.027706 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / activesupport-4.1.5 / lib / active_support / tagged_logging.rb:68:tagged
2014-10-04T18:17:49.027720 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / rack-1.5.2 / lib / rack / content_length.rb:14:在`call'
2014-10-04T18:17:49.027719 + 00:00 app [web.1]: vendor / bundle / ruby / 2.1.0 / gems / rack-1.5.2 / lib / rack / lock.rb:17:在`call'
2014-10-04T18:17:49.027705 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / activesupport-4.1.5 / lib / active_support / tagged_logging.rb:26:在`tagged'
2014-10-04T18:17: 49.027708 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / railties-4.1.5 / lib / rails / rack / logger.rb:20:在`cal l'
2014-10-04T18:17:49.027713 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / activesupport-4.1.5 / lib / active_support / cache /策略/ local_cache_middleware.rb:26:在`call'
2014-10-04T18:17:49.027710 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / rack- 1.5.2 / lib / rack / methodoverride.rb:21:在`call'
2014-10-04T18:17:49.027715 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1。 0 / gems / rack-1.5.2 / lib / rack / sendfile.rb:112:在`call'
2014-10-04T18:17:49.027724 + 00:00 app [web.1]:vendor / ruby-2.1.1 / lib / ruby / 2.1.0 / webrick / httpserver.rb:94:在`run'
2014-10-04T18:17:49.027723 + 00:00 app [web.1]: vendor / ruby-2.1.1 / lib / ruby / 2.1.0 / webrick / httpserver.rb:138:在'service'
2014-10-04T18:17:49.027714 + 00:00 app [web.1 ]:vendor / bundle / ruby / 2.1.0 / gems / actionpack-4.1.5 / lib / action_dispatch / middleware / static.rb:64:在`call'
2014-10-04T18:17:49.027718+ 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / railties-4.1.5 / lib / rails / application.rb:144:在`call'
2014-10- 04T18:17:49.027717 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / railties-4.1.5 / lib / rails / engine.rb:514:在`call'
2014-10-04T18:17:49.027709 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / actionpack-4.1.5 / lib / action_dispatch / middleware / request_id.rb: 21:在`call'
2014-10-04T18:17:49.027721 + 00:00 app [web.1]:vendor / bundle / ruby / 2.1.0 / gems / rack-1.5.2 / lib / rack / handler / webrick.rb:60:在'service'
2014-10-04T18:17:49.027725 + 00:00 app [web.1]:vendor / ruby-2.1.1 / lib / ruby / 2.1.0 / webrick / server.rb:295:在`block in start_thread'
2014-10-04T18:17:49.027727 + 00:00 app [web.1]:
2014-10- 04T18:17:49.027726 + 00:00 app [web.1]:
路线:
Rails.application.routes.draw do
root'listing#index'
devise_for:users
资源:列表
获取'页面/约'
获取'页面/联系'
结束
导航:
< ul class =nav navbar-nav navbar-right>
<%user_signed_in? %GT;
以< strong><%= current_user.email%>< / strong> ;.
<%= link_to'编辑个人资料',edit_user_registration_path,class => 'navbar-link'%> |
<%= link_to注销,destroy_user_session_path,方法::delete,:class => 'navbar-link'%>
<%else%>
<%= link_to注册,new_user_registration_path,class => 'navbar-link'%> |
<%= link_to登录,new_user_session_path,:class => 'navbar-link'%>
<%end%>
< / ul>
编辑
耙子路线:
前缀动词URI模式控制器#动作
root GET / listing#index
new_user_session GET /users/sign_in(.:format)devise / sessions#new
user_session POST /users/sign_in(.:format)devise / sessions#create
destroy_user_session DELETE / users / sign_out格式)devise / sessions#destroy
user_password POST /users/password(.:format)devise / passwords#create
new_user_password GET /users/password/new(.:format)devise / passwords#new
edit_user_password GET /users/password/edit(.:format)devise / passwords#edit
PATCH /users/password(.:format)devise / passwords#update
PUT / users / password( 。:format)devise / passwords#update
cancel_u ser_registration GET /users/cancel(.:format)设计/注册#取消
user_registration POST /users(.:format)设计/注册#创建
new_user_registration GET /users/sign_up(.:format)设计/注册#新
edit_user_registration GET /users/edit(.:format)设计/注册#编辑
PATCH /users(.:format)设计/注册#update
PUT / users(。 :format)devise / registrationments#update
DELETE /users(.:format)devise / registrations#destroy
listing GET /listings(.:format)listing#index
POST / listings(。 :format)listing#create
new_listing GET /listings/new(.:format)listing#new
edit_listing GET /listings/:id/edit(.:format)listing#edit
列出GET /listings/:id(.:format)listing#show
PATCH /listings/:id(.:format)listing#update
PUT /listings/:id(.:format)listing#更新
DELETE /listings/:id(.:format)listing#destroy
pages_about GET /pages/about(.:format)pages#about
pages_contact GET / pages / contact(.:格式)page#contact
可能与jQuery有关。
在任何其他条目之前,请确保在application.js文件(app / assets / javascripts / application.js)中包含以下行:
// = require jquery
// = require jquery_ujs
一个快速的修复将是更改devise.rb初始化器(config / initializers / devise.rb)上的注销方法:
config.sign_out_via =:get
I have an application deployed on Heroku. Everything is working fine, except for signing out. When I click the link to sign out I get this error:
"The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you are the application owner check the logs for more information."
For user authentiation I am using of course the devise gem, I have multiple solutions hovering around Stack Overflow however none of them worked for me. Take a look at the files below.
Heroku Logs:
2014-10-04T18:17:49.022165+00:00 app[web.1]: Started GET "/users/sign_out" for 66.65.108.74 at 2014-10-04 18:17:49 +0000
2014-10-04T18:17:49.027680+00:00 app[web.1]:
2014-10-04T18:17:49.027702+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-10-04T18:17:49.027684+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/users/sign_out"):
2014-10-04T18:17:49.027686+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-10-04T18:17:49.027699+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-10-04T18:17:49.027701+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-10-04T18:17:49.027704+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-10-04T18:17:49.027711+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-10-04T18:17:49.027706+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-10-04T18:17:49.027720+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-10-04T18:17:49.027719+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-10-04T18:17:49.027705+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-10-04T18:17:49.027708+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/rack/logger.rb:20:in `call'
2014-10-04T18:17:49.027713+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.5/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
2014-10-04T18:17:49.027710+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-10-04T18:17:49.027715+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-10-04T18:17:49.027724+00:00 app[web.1]: vendor/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
2014-10-04T18:17:49.027723+00:00 app[web.1]: vendor/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
2014-10-04T18:17:49.027714+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-10-04T18:17:49.027718+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/application.rb:144:in `call'
2014-10-04T18:17:49.027717+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.5/lib/rails/engine.rb:514:in `call'
2014-10-04T18:17:49.027709+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-10-04T18:17:49.027721+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-10-04T18:17:49.027725+00:00 app[web.1]: vendor/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
2014-10-04T18:17:49.027727+00:00 app[web.1]:
2014-10-04T18:17:49.027726+00:00 app[web.1]:
Routes:
Rails.application.routes.draw do
root 'listings#index'
devise_for :users
resources :listings
get 'pages/about'
get 'pages/contact'
end
Navigation:
<ul class="nav navbar-nav navbar-right">
<% if user_signed_in? %>
Logged in as <strong><%= current_user.email %></strong>.
<%= link_to 'Edit profile', edit_user_registration_path, :class => 'navbar-link' %> |
<%= link_to "Logout", destroy_user_session_path, method: :delete, :class => 'navbar-link' %>
<% else %>
<%= link_to "Sign up", new_user_registration_path, :class => 'navbar-link' %> |
<%= link_to "Login", new_user_session_path, :class => 'navbar-link' %>
<% end %>
</ul>
EDIT:
Rake Routes:
Prefix Verb URI Pattern Controller#Action
root GET / listings#index
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
listings GET /listings(.:format) listings#index
POST /listings(.:format) listings#create
new_listing GET /listings/new(.:format) listings#new
edit_listing GET /listings/:id/edit(.:format) listings#edit
listing GET /listings/:id(.:format) listings#show
PATCH /listings/:id(.:format) listings#update
PUT /listings/:id(.:format) listings#update
DELETE /listings/:id(.:format) listings#destroy
pages_about GET /pages/about(.:format) pages#about
pages_contact GET /pages/contact(.:format) pages#contact
It might be related to jQuery.
Be sure to have the following lines in your application.js file (app/assets/javascripts/application.js), before any other entry:
//= require jquery
//= require jquery_ujs
A quick fix would be to change the signout method on devise.rb initializer (config/initializers/devise.rb):
config.sign_out_via = :get
这篇关于Ruby on Rails:无法在生产中退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!