我的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:incall' 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:incall' 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:incall' 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:incall' 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:incall' actionpack (3.2.17) lib/action_dispatch/middleware/best_standards_support.rb:17:in
call' rack(1.4.5)lib / rack / etag.rb:23:incall' rack (1.4.5) lib/rack/conditionalget.rb:25:in
call' actionpack(3.2.17)lib / action_dispatch / middleware / head.rb:14:incall' 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:incall' 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:inblock 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:inrun_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:incall' 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:inprotected_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:incall' 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:incall' railties (3.2.17) lib/rails/rack/logger.rb:32:in
call_app' railties(3.2.17)lib / rails / rack / logger.rb:16:inblock in call' activesupport (3.2.17) lib/active_support/tagged_logging.rb:22:in
已标记' railties(3.2.17)lib / rails / rack / logger.rb:16:incall' actionpack (3.2.17) lib/action_dispatch/middleware/request_id.rb:22:in
来电' rack(1.4.5)lib / rack / methodoverride.rb:21:incall' 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:incall' rack (1.4.5) lib/rack/lock.rb:15:in
call' actionpack(3.2.17)lib / action_dispatch / middleware / static.rb:63:incall' 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:incall' 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:inservice' /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