aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/routing_url_for.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb
index 4d62ea809a..45e78d1ad9 100644
--- a/actionview/lib/action_view/routing_url_for.rb
+++ b/actionview/lib/action_view/routing_url_for.rb
@@ -84,21 +84,13 @@ module ActionView
when Hash
options = options.symbolize_keys
unless options.key?(:only_path)
- if options[:host].nil?
- options[:only_path] = _generate_paths_by_default
- else
- options[:only_path] = false
- end
+ options[:only_path] = only_path?(options[:host])
end
super(options)
when ActionController::Parameters
unless options.key?(:only_path)
- if options[:host].nil?
- options[:only_path] = _generate_paths_by_default
- else
- options[:only_path] = false
- end
+ options[:only_path] = only_path?(options[:host])
end
super(options)
@@ -147,5 +139,9 @@ module ActionView
def _generate_paths_by_default
true
end
+
+ def only_path?(host)
+ _generate_paths_by_default unless host
+ end
end
end