Showing posts with label redirect_back_or_default. Show all posts
Showing posts with label redirect_back_or_default. Show all posts

Wednesday, January 16, 2008

redirect_back_or_default in Rails 2.0

Since they removed redirect_back_or_default in Rails 2.0, and I still had a need to do something like that, I made method you can put under the private portion of your ApplicationController:

def redirect_back_or(path)
redirect_to :back
rescue ActionController::RedirectBackError
redirect_to path
end

and you use it just like the redirect_back_or_default method.