diff options
-rw-r--r-- | actionpack/lib/action_controller/metal/url_for.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb index dc742ce466..0f2fa5fb08 100644 --- a/actionpack/lib/action_controller/metal/url_for.rb +++ b/actionpack/lib/action_controller/metal/url_for.rb @@ -34,14 +34,13 @@ module ActionController (script_name = env["ROUTES_#{_routes.object_id}_SCRIPT_NAME"]) || (original_script_name = env['ORIGINAL_SCRIPT_NAME'.freeze]) - @_url_options.dup.tap do |options| - if original_script_name - options[:original_script_name] = original_script_name - else - options[:script_name] = same_origin ? request.script_name.dup : script_name - end - options.freeze + options = @_url_options.dup + if original_script_name + options[:original_script_name] = original_script_name + else + options[:script_name] = same_origin ? request.script_name.dup : script_name end + options.freeze else @_url_options end |