Home

with_url_scope allows you to pass the same parameters to many urls DRYly. It works pretty much like with_scope for active record. By default options passed explicity or implicitly will override the parameters passed to with_url_scope, the exception is for those options passed via :overwrite => { ... } which will take precidence over any parameter, even :action, :controller and :only_path.

Examples:

<% with_url_scope(:return_to => request.uri) do %>
  <%= link_to 'Sign Up', signup_path %>
  <%= link_to 'Login', login_path %>
<% end %>

Last edited by caring, 4 months ago
Versions: