diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-04-18 16:55:40 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-04-18 17:12:40 +0100 |
commit | 3ba6ae95f0da7b69f6c16ad61df027234a20506a (patch) | |
tree | cd3162b7b76b704c639c1cbe124991a956fe8ccd /actionpack/lib | |
parent | 6183e1a460ccab6df1d07c3e99e98b61b2cc450b (diff) | |
download | rails-3ba6ae95f0da7b69f6c16ad61df027234a20506a.tar.gz rails-3ba6ae95f0da7b69f6c16ad61df027234a20506a.tar.bz2 rails-3ba6ae95f0da7b69f6c16ad61df027234a20506a.zip |
Duplicate options before mutating them
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/url.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/http/url.rb b/actionpack/lib/action_dispatch/http/url.rb index e9d4cd6c34..5caff769bb 100644 --- a/actionpack/lib/action_dispatch/http/url.rb +++ b/actionpack/lib/action_dispatch/http/url.rb @@ -28,6 +28,7 @@ module ActionDispatch end def url_for(options = {}) + options = options.dup path = options.delete(:script_name).to_s.chomp("/") path << options.delete(:path).to_s diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index d48a83e6c6..342b6ec23d 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -170,9 +170,10 @@ module ActionDispatch def call(t, args) if args.size == arg_size && !args.last.is_a?(Hash) && optimize_routes_generation?(t) - @options.merge!(t.url_options) if t.respond_to?(:url_options) - @options[:path] = optimized_helper(args) - ActionDispatch::Http::URL.url_for(@options) + options = @options.dup + options.merge!(t.url_options) if t.respond_to?(:url_options) + options[:path] = optimized_helper(args) + ActionDispatch::Http::URL.url_for(options) else super end |