【发布时间】:2016-07-28 14:14:59
【问题描述】:
所以我有一个带有控制器的 Rails 应用程序,该控制器有很多方法。由于某种原因,应用程序有时无法正确解释对该控制器的调用。例如:
A 404 error occurred on the Production server at 2016-07-28 02:55:23 UTC:
Message:
Problem: Document(s) not found for class Section with id(s) publish_preview. Summary: When calling Section.find ... [etc.]
Requested Params
{"action"=>"update", "controller"=>"sections", "organization_id"=>"goannunciation", "bulletin_id"=>"20160731", "id"=>"publish_preview"}
Url:
bulletinbuilder.org/organizations/goannunciation/bulletins/20160731/sections/publish_preview
因此,sections 控制器有一个“publish_preview”方法,这个 URL 应该——而且通常会——适当地调用它。但是,最近该应用程序没有正确解释 URL;从堆栈中:
"/var/www/bulletin_builder/releases/20160725175809/app/controllers/sections_controller.rb:34:in `update'"
这表明应用程序正在调用“更新方法”,使用实际方法调用“publish_preview”作为部分的 id。这一定是某种路由错误......可能与标题有关?浏览器相关?
resources :organizations do
...
resources :bulletins do
...
resources :sections do
collection do
get :manage
get :first_section
get :bulletin_creation
get :included_sections
get :custom_sections_max_message
get :search
get :publish_preview
get :admin_diagnostics
end
member do
post :remove
post :removed_blocked_section
get :delete_dynamic
get :update_included
get :update_added
get :share
get :unshare
get :refresh
end
end
正如我在下面的评论中提到的,相关路线没有改变,问题只是偶尔发生。
此外,由于某种原因,服务器会针对同一错误发送一堆 (17) 封错误通知电子邮件,所有这些电子邮件都在几秒钟之内发生。
【问题讨论】:
-
能否请您发布此特定控制器的路线
标签: ruby-on-rails mongodb object methods