public Method

GeneratorMethods.redirect_to(location)

Redirects the browser to the given location using JavaScript, in the same form as url_for.

Examples:

# Generates: window.location.href = "/mycontroller";
page.redirect_to(:action => 'index')

# Generates: window.location.href = "/account/signup";
page.redirect_to(:controller => 'account', :action => 'signup')

Source Code

# File action_view/helpers/prototype_helper.rb, line 845
def redirect_to(location)
  assign 'window.location.href', @context.url_for(location)
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.