2013-02-22 39 views
2

我在顯示相當錯誤的頁面(example)),當我的用戶出現錯誤500或404時,我跟着this guide,並且它適用於不再存在的頁面,但不適用於過期的資產(不再存在),即/assets/wood_bg2-7ab28512ecf6eeeb5f3742babca48a7b5.png的圖像 - 對於那些顯示「空白」和「醜陋」缺失圖像(example ),而不是我的漂亮的自定義404錯誤頁面Rails中的自定義錯誤頁面不會顯示過期資產漂亮的404(不再存在)

我通過exception_notification寶石得到的錯誤:

An ActionView::MissingTemplate occurred in errors#error_404: Missing template errors/error_404, application/error_404 with {:locale=>[:en], :formats=>[:png], :handlers=>[:erb, :builder, :coffee, :haml]}. 

所以,也許我只需要「告訴」錯誤頁面/路線,它應該顯示我的錯誤頁面的PNG,JPG等文件呢?

任何想法如何解決這個問題?

謝謝:)

+0

嗨@rassom你有沒有想過這個? – 2013-08-06 02:57:08

回答

1

我曾經實現了nifty_errorpages gem。它在github上可用:https://github.com/mattherick/nifty_errorpages。也許我的實施可以幫助你解決你的問題。它用於導軌3.2。如果你有3.1簡單的檢查源代碼,否則你可以將它添加到你的Gemfile並直接嘗試它。

+0

太棒了!謝謝! :-) – rassom 2013-08-12 09:48:38