aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/url_helper.rb
diff options
context:
space:
mode:
authorMilan Dobrota <mdobrota@tribune.com>2011-09-04 10:44:08 -0500
committerMilan Dobrota <mdobrota@tribune.com>2011-09-04 10:44:08 -0500
commit9b08afd2f4d501fb1710ba0ed4e19313093605c8 (patch)
tree93c181f5831e772f6ab044516fb36be43dbd3aa3 /actionpack/lib/action_view/helpers/url_helper.rb
parentabb09054043c556ae38d2c9d1e9037eceb6dc426 (diff)
downloadrails-9b08afd2f4d501fb1710ba0ed4e19313093605c8.tar.gz
rails-9b08afd2f4d501fb1710ba0ed4e19313093605c8.tar.bz2
rails-9b08afd2f4d501fb1710ba0ed4e19313093605c8.zip
if ... nil? is more expensive than unless
Diffstat (limited to 'actionpack/lib/action_view/helpers/url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 4dbb0135f6..0cdc103df3 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -596,9 +596,7 @@ module ActionView
private
def convert_options_to_data_attributes(options, html_options)
- if html_options.nil?
- link_to_remote_options?(options) ? {'data-remote' => 'true'} : {}
- else
+ if html_options
html_options = html_options.stringify_keys
html_options['data-remote'] = 'true' if link_to_remote_options?(options) || link_to_remote_options?(html_options)
@@ -611,6 +609,8 @@ module ActionView
add_method_to_attributes!(html_options, method) if method
html_options
+ else
+ link_to_remote_options?(options) ? {'data-remote' => 'true'} : {}
end
end