Permalink
Browse files

Merge pull request #7865 from teleological/link_to_remote_3_2

Accept :remote as symbol in link_to options (backport)
  • Loading branch information...
2 parents f668ab9 + 380800e commit bf07c79a02d7498c9025d97b1302a80d21066ba5 @rafaelfranca rafaelfranca committed Oct 7, 2012
View
@@ -1,5 +1,7 @@
## Rails 3.2.9 (unreleased) ##
+* Accept :remote as symbolic option for `link_to` helper. *Riley Lynch*
+
* Warn when the `:locals` option is passed to `assert_template` outside of a view test case
Fix #3415
@@ -633,7 +633,9 @@ def convert_options_to_data_attributes(options, html_options)
end
def link_to_remote_options?(options)
- options.is_a?(Hash) && options.key?('remote') && options.delete('remote')
+ if options.is_a?(Hash)
+ options.delete('remote') || options.delete(:remote)
+ end
end
def add_method_to_attributes!(html_options, method)
@@ -227,6 +227,13 @@ def test_link_to_with_remote_false
)
end
+ def test_link_to_with_symbolic_remote_in_non_html_options
+ assert_dom_equal(
+ "<a href=\"/\" data-remote=\"true\">Hello</a>",
+ link_to("Hello", hash_for([:remote, true]), {})
+ )
+ end
+
def test_link_tag_using_post_javascript
assert_dom_equal(
"<a href='http://www.example.com' data-method=\"post\" rel=\"nofollow\">Hello</a>",

0 comments on commit bf07c79

Please sign in to comment.