Browse files

Add rel=nofollow on non get remote links

  • Loading branch information...
1 parent 31820b9 commit 48459c82783c53e1ac671259d65c806384f60f2b @josh josh committed Jan 30, 2010
Showing with 3 additions and 3 deletions.
  1. +1 −1 actionpack/lib/action_view/helpers/url_helper.rb
  2. +2 −2 actionpack/test/template/url_helper_test.rb
View
2 actionpack/lib/action_view/helpers/url_helper.rb
@@ -584,7 +584,7 @@ def add_confirm_to_attributes!(html_options, confirm)
end
def add_method_to_attributes!(html_options, method)
- html_options["rel"] = "nofollow" if method && method.to_s.downcase == "delete"
+ html_options["rel"] = "nofollow" if method && method.to_s.downcase != "get"
html_options["data-method"] = method if method
end
View
4 actionpack/test/template/url_helper_test.rb
@@ -192,7 +192,7 @@ def test_link_to_with_remote
def test_link_tag_using_post_javascript
assert_dom_equal(
- "<a href='http://www.example.com' data-method=\"post\">Hello</a>",
+ "<a href='http://www.example.com' data-method=\"post\" rel=\"nofollow\">Hello</a>",
link_to("Hello", "http://www.example.com", :method => :post)
)
end
@@ -213,7 +213,7 @@ def test_link_tag_using_delete_javascript_and_href
def test_link_tag_using_post_javascript_and_confirm
assert_dom_equal(
- "<a href=\"http://www.example.com\" data-method=\"post\" data-confirm=\"Are you serious?\">Hello</a>",
+ "<a href=\"http://www.example.com\" data-method=\"post\" rel=\"nofollow\" data-confirm=\"Are you serious?\">Hello</a>",
link_to("Hello", "http://www.example.com", :method => :post, :confirm => "Are you serious?")
)
end

0 comments on commit 48459c8

Please sign in to comment.