Skip to content

Commit

Permalink
Use this.href, not unexisting url
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2150 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Sep 7, 2005
1 parent 7e3dc80 commit 7b235f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/url_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def popup_javascript_function(popup)
end

def post_javascript_function
"f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = url; f.submit();"
"f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit();"
end

# Processes the _html_options_ hash, converting the boolean
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/template/url_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_link_tag_with_popup_and_javascript_confirm

def test_link_tag_using_post_javascript
assert_equal(
"<a href=\"http://www.example.com\" onclick=\"f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = url; f.submit();return false;\">Hello</a>",
"<a href=\"http://www.example.com\" onclick=\"f = document.createElement('form'); document.body.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit();return false;\">Hello</a>",
link_to("Hello", "http://www.example.com", :post => true)
)
end
Expand Down

0 comments on commit 7b235f0

Please sign in to comment.