我能redirect所有(無效)網址中使用this line at the end of the routes file:重定向和提高閃點消息時捕獲所有的路線
match '*a' => redirect('/')
我想要做的重定向,並通過在routes.rb
警報消息。
喜歡的東西(語法錯在這裏):
match '*a' => redirect('/'), :alert => "aaargh, you don't want to go to #{params[:a]}"
是否有可能做到這一點?
如果我在觀看/控制器這樣做,我可以使用redirect_to
和快閃消息傳遞重定向頁面上(見redirecting in the docs例子)。創建一個新的控制器方法並在那裏重定向會起作用,但它看起來很不雅...是推薦的方式嗎?
很酷的解決方案... – Nich 2013-04-25 11:37:52