简体   繁体   English

Rails升级到3.2 ActionNotFound奇怪的路由错误

[英]Rails Upgrade To 3.2 ActionNotFound Strange Routing Error

I have a rather bizarre error happening on upgrading from Rails 3.1.12 to 3.2.17. 从Rails 3.1.12升级到3.2.17时发生了一个非常奇怪的错误。

Basically, I can load a page once, but as soon as I hit refresh, I get a 基本上,我可以加载一次页面,但是只要刷新一下,我就会获得一个

AbstractController::ActionNotFound 

I'll say that again incase you missed it. 如果您错过了,我再说一遍。 I CAN load the page, ONCE. 我可以一次加载页面。 So I know the routes are fine, but if I refresh the exact same page, I get this action not found. 因此,我知道路由很好,但是如果刷新完全相同的页面,则会发现此操作未找到。

This happens on every single page. 这发生在每个页面上。 I can view it once, but on refresh I can't view it again. 我可以查看一次,但是刷新后无法查看。

Ways to fix it, are to either bounce the rails server or make a change to the routes file and save it. 修复它的方法是使rails服务器反弹或对route文件进行更改并保存。

The routes file is way to big to post, so i'll just use a single page for an example here. 路由文件是一种很大的发布方式,因此在这里我仅使用一个页面作为示例。
The page is found at /dashboard 该页面位于/ dashboard

The route is: 路线是:

match '/dashboard', :to => 'pages#dashboard'

I hit that page, it loads fine, I hit it again, it fails with 我点击了该页面,加载正常,我再次点击了该页面,但失败了

AbstractController::ActionNotFound at /dashboard
The action 'dashboard_pages' could not be found for PagesController

The action is called "dashboard" on the pages controller. 该操作在页面控制器上称为“仪表板”。

Iv been googling this for a while now, and its the whole "1 view" thing that has be baffled. 我已经搜索了一段时间了,而整个“ 1视图”问题却令人困惑。 I cant find anyone else who has this problem. 我找不到其他人遇到这个问题。

Any help would be appreciated. 任何帮助,将不胜感激。

Heres the stack trace: 这是堆栈跟踪:

    AbstractController::ActionNotFound - The action 'dashboard_pages' could not be found for PagesController:
      actionpack (3.2.17) lib/abstract_controller/base.rb:116:in `process'
      actionpack (3.2.17) lib/abstract_controller/rendering.rb:45:in `process'
      actionpack (3.2.17) lib/action_controller/metal.rb:203:in `dispatch'
      actionpack (3.2.17) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
      actionpack (3.2.17) lib/action_controller/metal.rb:246:in `block in action'
      actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
      actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:36:in `call'
      journey (1.0.4) lib/journey/router.rb:68:in `block in call'
      journey (1.0.4) lib/journey/router.rb:56:in `call'
      actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:608:in `call'
      meta_request (0.2.8) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
      rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'
      meta_request (0.2.8) lib/meta_request/middlewares/headers.rb:16:in `call'
      meta_request (0.2.8) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
      newrelic_rpm (3.7.3.204) lib/new_relic/rack/error_collector.rb:55:in `call'
      newrelic_rpm (3.7.3.204) lib/new_relic/rack/agent_hooks.rb:32:in `call'
      newrelic_rpm (3.7.3.204) lib/new_relic/rack/browser_monitoring.rb:27:in `call'
      newrelic_rpm (3.7.3.204) lib/new_relic/rack/developer_mode.rb:45:in `call'
      http_accept_language (2.0.1) lib/http_accept_language/middleware.rb:13:in `call'
      warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
      warden (1.2.3) lib/warden/manager.rb:34: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:in `call'
      rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
      rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
      actionpack (3.2.17) lib/action_dispatch/middleware/cookies.rb:341:in `call'
      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 `_run__3098765915505928900__call__1549657330245414969__callbacks'
      activesupport (3.2.17) lib/active_support/callbacks.rb:405:in `__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 (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
      better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
      better_errors (1.1.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 `tagged'
      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 `call'
      rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
      rack (1.4.5) lib/rack/runtime.rb:17: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'
       () usr/local/rvm/gems/ruby-1.9.3-p327@secure/bundler/gems/raven-ruby-e6d646402dc7/lib/raven/rack.rb:47:in `call'
      railties (3.2.17) lib/rails/engine.rb:484:in `call'
      railties (3.2.17) lib/rails/application.rb:231:in `call'
      rack (1.4.5) lib/rack/content_length.rb:14:in `call'
      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-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
      /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
      /usr/local/rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

I found the problem. 我发现了问题。

There was a piece of code that was printing action_name << controller_name in the view. 在视图中有一段代码正在打印action_name << controller_name。 In Rails 3.1 , this just concatenated the strings and printed it. 在Rails 3.1中,这只是连接字符串并打印出来。 In 3.2 is alters the request parameters. 在3.2中更改请求参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM