Ruby on rails RubyonRails中的自定义动态错误页不工作
我正在尝试实现以下自定义动态错误页面: 我完全按照博客上的话做了。我在我的environment.rb中包含了config.action\u controller.consude\u all\u requests\u local=false。但它不起作用 我的浏览器显示:Ruby on rails RubyonRails中的自定义动态错误页不工作,ruby-on-rails,Ruby On Rails,我正在尝试实现以下自定义动态错误页面: 我完全按照博客上的话做了。我在我的environment.rb中包含了config.action\u controller.consude\u all\u requests\u local=false。但它不起作用 我的浏览器显示: Routing Error No route matches "/555" with {:method=>:get} 看来营救行动还没有启动。 我在日志文件中得到以下信息: ActionController::Rou
Routing Error
No route matches "/555" with {:method=>:get}
看来营救行动还没有启动。
我在日志文件中得到以下信息:
ActionController::RoutingError (No route matches "/555" with {:method=>:get}):
Rendering rescues/layout (not_found)
是否有路由干扰代码?我不知道该找什么。我正在运行rails 2.3.5
以下是routes.rb文件:
ActionController::Routing::Routes.draw do |map|
# routing van property-url
map.connect 'buy/:property_type_plural/:province/:city/:address/:house_number', :controller => 'properties' , :action => 'show', :id => 'whatever'
map.myimmonatie 'myimmonatie' , :controller => 'myimmonatie/properties', :action => 'index'
map.login "login", :controller => "user_sessions", :action => "create", :conditions => {:method => :post}
map.login "login", :controller => "user_sessions", :action => "new"
map.logout "logout", :controller => "user_sessions", :action => "destroy"
map.buy "buy", :controller => 'buy'
map.sell "sell", :controller => 'sell'
map.home "home", :controller => 'home'
map.disclaimer "disclaimer", :controller => 'disclaimer'
map.sign_up "sign_up", :controller => 'users', :action => :new
map.contact "contact", :controller => 'contact'
map.resources :user_sessions
map.resources :contact
map.resources :password_resets
map.resources :messages
map.resources :users, :only => [:index,:new,:create,:activate,:edit,:profile,:password]
map.resources :images
map.resources :activation , :only => [:new,:resend]
map.resources :email
map.resources :properties, :except => [:index,:destroy]
map.namespace :admin do |admin|
admin.resources :users
admin.resources :properties
admin.resources :order_items, :as => :orders
admin.resources :blog_posts, :as => :blog
end
map.connect 'myimmonatie/:action' , :controller => 'users', :id => 'current', :requirements => {:action => /(profile)|(password)|(email)/}
map.namespace :myimmonatie do |myimmonatie|
myimmonatie.resources :messages, :controller => 'messages'
myimmonatie.resources :password, :as => "password", :controller => 'users', :action => 'password'
myimmonatie.resources :properties , :controller => 'properties'
myimmonatie.resources :orders , :only => [:index,:show,:create,:new]
end
map.root :controller => "home"
map.connect ':controller/:action'
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
ActionController::Routing::Translator.translate_from_file('config','i18n-routes.yml')
代码运行正常,my environment.rb中的行有问题 config.action\u controller.consumer\u all\u requests\u local=false 它似乎在某个地方被覆盖了
所以,案件结案了,谢谢 Rails会在您使用ip 127.0.0.1浏览时进行检测,并向您显示开发环境错误,即使您在生产环境中也是如此。您应该尝试从其他计算机访问以获得正确的错误。config/routes.rb中有什么内容?我在问题中添加了该文件