假设我们有一条路线:
get "foo/:foo_param" =>"blahblah" , :as=>"rails_some_route"
在我看来,我写道:
"rails_some_route_path('aa')" this give proper url => 'foo/aa'
但如果一个视图(另一个 .slim 文件)意外包含
"a href=#{rails_some_route_path(nil)}"
. 视图本身呈现为 404 。
只有路由应该被破坏,但奇怪的是页面本身呈现 404
consider_all_requests_local
对 dev 来说是错误的
应用控制器
unless config.consider_all_requests_local
rescue_from ActionController::RoutingError, :with => :render_404
rescue_from ActionController::UnknownController, :with => :render_404
rescue_from ActionController::UnknownAction, :with => :render_404
rescue_from Error404, :with => :render_404
rescue_from GoshPosh::Platform::Errors::AuthError do
redirect_to login_path({:rd=>request.path})
end
end
路线:
unless Rails.application.config.consider_all_requests_local
match '*not_found', :to => 'web_application#render_404'
end