AbstractController :: ActionNotFound(无法找到UserSessionsController的动作' show'):

时间:2014-03-17 09:35:18

标签: ruby ruby-on-rails-3 routes action usersession

我的ruby应用程序存在一些问题。 我用: Ruby = 2.0 Rails = 3.2

当我尝试退出时,我有一个像这样的错误。

  

AbstractController :: ActionNotFound - 动作'显示'找不到UserSessionsController:     actionpack(3.2.17)lib / abstract_controller / base.rb:116:在process' actionpack (3.2.17) lib/abstract_controller/rendering.rb:45:in进程'     actionpack(3.2.17)lib / action_controller / metal.rb:203:在dispatch' actionpack (3.2.17) lib/action_controller/metal/rack_delegation.rb:14:in发送'     actionpack(3.2.17)lib / action_controller / metal.rb:246:在block in action' actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:73:in发送'     actionpack(3.2.17)lib / action_dispatch / routing / route_set.rb:36:in call' journey (1.0.4) lib/journey/router.rb:68:in阻止通话'     旅程(1.0.4)lib / journey / router.rb:56:在call' actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:608:in电话'     bullet(4.1.4)lib / bullet / rack.rb:8:in call' hirefire-resource (0.1.2) lib/hirefire/middleware.rb:27:in call'     newrelic_rpm(3.6.2.96)lib / new_relic / rack / error_collector.rb:12:in call' newrelic_rpm (3.6.2.96) lib/new_relic/rack/agent_hooks.rb:18:in call'     newrelic_rpm(3.6.2.96)lib / new_relic / rack / browser_monitoring.rb:16:in call' newrelic_rpm (3.6.2.96) lib/new_relic/rack/developer_mode.rb:28:in来电'     request_store(1.0.5)lib / request_store / middleware.rb:9:in call' actionpack (3.2.17) lib/action_dispatch/middleware/best_standards_support.rb:17:in call'     rack(1.4.5)lib / rack / etag.rb:23:in call' rack (1.4.5) lib/rack/conditionalget.rb:25:in call'     actionpack(3.2.17)lib / action_dispatch / middleware / head.rb:14:in call' actionpack (3.2.17) lib/action_dispatch/middleware/params_parser.rb:21:in call'     actionpack(3.2.17)lib / action_dispatch / middleware / flash.rb:242:call' rack (1.4.5) lib/rack/session/abstract/id.rb:210:in上下文'     rack(1.4.5)lib / rack / session / abstract / id.rb:205:在call' actionpack (3.2.17) lib/action_dispatch/middleware/cookies.rb:341:in电话'     activerecord(3.2.17)lib / active_record / query_cache.rb:64:in call' activerecord (3.2.17) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in call'     actionpack(3.2.17)lib / action_dispatch / middleware / callbacks.rb:28:in block in call' activesupport (3.2.17) lib/active_support/callbacks.rb:405:in 运行 _4032778647788681780_ 致电 _3401891405258349156__callbacks'     activesupport(3.2.17)lib / active_support / callbacks.rb:405:在__run_callback' activesupport (3.2.17) lib/active_support/callbacks.rb:385:in _ run_call_callbacks'     activesupport(3.2.17)lib / active_support / callbacks.rb:81:in run_callbacks' actionpack (3.2.17) lib/action_dispatch/middleware/callbacks.rb:27:in call'     actionpack(3.2.17)lib / action_dispatch / middleware / reloader.rb:65:in call' actionpack (3.2.17) lib/action_dispatch/middleware/remote_ip.rb:31:in call'     better_errors(0.9.0)lib / better_errors / middleware.rb:84:in protected_app_call' better_errors (0.9.0) lib/better_errors/middleware.rb:79:in better_errors_call'     better_errors(0.9.0)lib / better_errors / middleware.rb:56:in call' actionpack (3.2.17) lib/action_dispatch/middleware/debug_exceptions.rb:16:in call'     actionpack(3.2.17)lib / action_dispatch / middleware / show_exceptions.rb:56:in call' railties (3.2.17) lib/rails/rack/logger.rb:32:in call_app'     railties(3.2.17)lib / rails / rack / logger.rb:16:in block in call' activesupport (3.2.17) lib/active_support/tagged_logging.rb:22:in已标记'     railties(3.2.17)lib / rails / rack / logger.rb:16:in call' actionpack (3.2.17) lib/action_dispatch/middleware/request_id.rb:22:in来电'     rack(1.4.5)lib / rack / methodoverride.rb:21:in call' rack-contrib (1.1.0) lib/rack/contrib/runtime.rb:18:in call'     activesupport(3.2.17)lib / active_support / cache / strategy / local_cache.rb:72:in call' rack (1.4.5) lib/rack/lock.rb:15:in call'     actionpack(3.2.17)lib / action_dispatch / middleware / static.rb:63:in call' railties (3.2.17) lib/rails/engine.rb:484:in call'     railties(3.2.17)lib / rails / application.rb:231:call' rack (1.4.5) lib/rack/content_length.rb:14:in电话'     railties(3.2.17)lib / rails / rack / log_tailer.rb:17:in call' rack (1.4.5) lib/rack/handler/webrick.rb:59:in service'     /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:138:in service' /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:94:in运行'     /usr/local/rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/webrick/server.rb:295:in在start_thread中阻止'

这是我的routes.rb:

root to: 'user_session#new'
match '/user_sessions/new' => redirect('/user_session/new')
enter code here
controller :user_sessions do
get    'user_session/new'     => :new,  as: 'new_user_session'
get    'user_session/edit'    => :edit, as: 'edit_user_session'
get    'user_session'         => :show, as: 'user_session'
put    'user_session'         => :update
delete 'user_session'         => :destroy
post   'user_session'         => :create
end

并将此信息发送至user_session_controller.rb

def destroy
current_user_session.destroy
redirect_to new_user_session_url
end

0 个答案:

没有答案