diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-20 14:58:51 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-20 14:58:51 -0200 |
commit | 063b058e28de226272bff64508f6a68d471fa398 (patch) | |
tree | ac0ea7a99b51a155182250b7e877888aeb745283 /actionview | |
parent | bb9d20cf3434e20ac6f275e3ad29be42ebec207f (diff) | |
parent | a13ad4a6c1e72edc3ec03e98c94fe865ad147d2e (diff) | |
download | rails-063b058e28de226272bff64508f6a68d471fa398.tar.gz rails-063b058e28de226272bff64508f6a68d471fa398.tar.bz2 rails-063b058e28de226272bff64508f6a68d471fa398.zip |
Merge pull request #17143 from kuldeepaggarwal/fix-mailTo
mail_to helper method fix
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/helpers/url_helper.rb | 2 | ||||
-rw-r--r-- | actionview/test/template/url_helper_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index 33882063f9..3dbce0738e 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -459,7 +459,7 @@ module ActionView html_options = (html_options || {}).stringify_keys extras = %w{ cc bcc body subject reply_to }.map! { |item| - option = html_options.delete(item) || next + option = html_options.delete(item).presence || next "#{item.dasherize}=#{Rack::Utils.escape_path(option)}" }.compact extras = extras.empty? ? '' : '?' + extras.join('&') diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index ee3313489f..ef4df0407a 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -495,6 +495,11 @@ class UrlHelperTest < ActiveSupport::TestCase %{<a href="mailto:me@example.com?cc=ccaddress%40example.com&bcc=bccaddress%40example.com&body=This%20is%20the%20body%20of%20the%20message.&subject=This%20is%20an%20example%20email&reply-to=foo%40bar.com">My email</a>}, mail_to("me@example.com", "My email", cc: "ccaddress@example.com", bcc: "bccaddress@example.com", subject: "This is an example email", body: "This is the body of the message.", reply_to: "foo@bar.com") ) + + assert_dom_equal( + %{<a href="mailto:me@example.com?body=This%20is%20the%20body%20of%20the%20message.&subject=This%20is%20an%20example%20email">My email</a>}, + mail_to("me@example.com", "My email", cc: '', bcc: '', subject: "This is an example email", body: "This is the body of the message.") + ) end def test_mail_to_with_img |