Re: [RoR ] 錯誤連結

看板Ruby作者 (怎麼有辦法這麼大聲)時間16年前 (2007/12/17 09:24), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
※ 引述《kojilin (怎麼有辦法這麼大聲)》之銘言: : rescue_action_in_public : 看看 : 像是 : def rescue_action_in_public(exception) : case exception : when ActiveRecord::RecordNotFound then : render :file => "#{RAILS_ROOT}/public/500.html" : when NoMethodError : render :file => "#{RAILS_ROOT}/public/500.html" : else : render :file => "#{RAILS_ROOT}/public/500.html" : end : end : 這個如何? : 在2.0.1可以寫成 : rescue_from(ActiveRecord::RecordNotFound) \\ : { |e| render :file => "#{RAILS_ROOT}/public/500.html" } : 只是看消息好像ActionController::RoutingError在2是丟404所以無法處理, : http://dev.rubyonrails.org/ticket/10328 : koji 補上 development時要把development.rb內的 config.action_controller.consider_all_requests_local 改成false 在localhost測的話要 def local_request? false end 應該就可了..try看看 koji -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.138.150.67
文章代碼(AID): #17PS_h9j (Ruby)
文章代碼(AID): #17PS_h9j (Ruby)