Permalink
Browse files

Duplicate options before mutating them

  • Loading branch information...
1 parent 6183e1a commit 3ba6ae95f0da7b69f6c16ad61df027234a20506a @pixeltrix pixeltrix committed Apr 18, 2013
@@ -28,6 +28,7 @@ def extract_subdomain(host, tld_length = @@tld_length)
end
def url_for(options = {})
+ options = options.dup
path = options.delete(:script_name).to_s.chomp("/")
path << options.delete(:path).to_s
@@ -170,9 +170,10 @@ def initialize(route, options)
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

0 comments on commit 3ba6ae9

Please sign in to comment.