Thursday, 26 September 2013

Redirect rails app to home page on crash

Redirect rails app to home page on crash

I want my app to redirect to my home page ie posts#index. It is a rails2
app which I am trying to migrate to rails 3.
def rescue_action_in_public(exception)
flash[:notice] = "There was an error. Please try again." # #{exception}
redirect_to :controller => :posts, :action => :index
end
This method I presume does this task. How ever, It won't work in rails 3
and I see the 'Sorry something went wrong!' page
How can I get this functionality working in rails 3? If any more info is,
needed I am willing to paste here.

No comments:

Post a Comment