diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-30 10:56:48 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-30 10:56:55 -0700 |
commit | fd924371126a50789d31582b9efa074fd47a803e (patch) | |
tree | a897c7edf10c46e12c628548413d9072b8942c32 | |
parent | ca20037899e55ddf734b727454a3180bebf82212 (diff) | |
download | rails-fd924371126a50789d31582b9efa074fd47a803e.tar.gz rails-fd924371126a50789d31582b9efa074fd47a803e.tar.bz2 rails-fd924371126a50789d31582b9efa074fd47a803e.zip |
split nil / Hash cases in url_for
this reduces the number of comparisons and method calls `url_for`
requires. The nil case no longer calls `symbolize_keys`, we already
know options is nil, so no more ||=, and since it is nil we already know
that options[:host] will be nil too.
-rw-r--r-- | actionview/lib/action_view/routing_url_for.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionview/lib/action_view/routing_url_for.rb b/actionview/lib/action_view/routing_url_for.rb index 33be06cbf7..b9e4b590e7 100644 --- a/actionview/lib/action_view/routing_url_for.rb +++ b/actionview/lib/action_view/routing_url_for.rb @@ -77,10 +77,10 @@ module ActionView case options when String options - when nil, Hash - options ||= {} - options = { :only_path => options[:host].nil? }.merge!(options.symbolize_keys) - super + when nil + super({:only_path => true}) + when Hash + super({ :only_path => options[:host].nil? }.merge!(options.symbolize_keys)) when :back _back_url when Array |