diff options
Diffstat (limited to 'actionpack/lib/action_dispatch/routing')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 14 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/url_for.rb | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index e3ad3f9ba7..7947e9d393 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -603,12 +603,9 @@ module ActionDispatch options[:constraints] ||= {} unless options[:constraints].is_a?(Hash) - options[:blocks] = options[:constraints] - options[:constraints] = {} + block, options[:constraints] = options[:constraints], {} end - options[:options] = options - scope_options.each do |option| if value = options.delete(option) recover[option] = @scope[option] @@ -616,12 +613,21 @@ module ActionDispatch end end + recover[:block] = @scope[:blocks] + @scope[:blocks] = merge_blocks_scope(@scope[:blocks], block) + + recover[:options] = @scope[:options] + @scope[:options] = merge_options_scope(@scope[:options], options) + yield self ensure scope_options.each do |option| @scope[option] = recover[option] if recover.has_key?(option) end + + @scope[:options] = recover[:options] + @scope[:blocks] = recover[:block] end # Scopes routes to a specific controller diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index 8fc8dc191b..39ba83fb9a 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -42,7 +42,7 @@ module ActionDispatch # url_for(:controller => 'users', # :action => 'new', # :message => 'Welcome!', - # :host => 'www.example.com') # Changed this. + # :host => 'www.example.com') # # => "http://www.example.com/users/new?message=Welcome%21" # # By default, all controllers and views have access to a special version of url_for, @@ -52,7 +52,7 @@ module ActionDispatch # # For convenience reasons, mailers provide a shortcut for ActionController::UrlFor#url_for. # So within mailers, you only have to type 'url_for' instead of 'ActionController::UrlFor#url_for' - # in full. However, mailers don't have hostname information, and what's why you'll still + # in full. However, mailers don't have hostname information, and that's why you'll still # have to specify the <tt>:host</tt> argument when generating URLs in mailers. # # |