diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-02-22 18:40:48 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-02-22 18:40:48 -0300 |
commit | 1358fce5aa77982b8b7eabcad959e1799d420a2b (patch) | |
tree | 4ecab9fc7478b14d63abeb907a9e52a725fc5b15 /actionview/lib/action_view/helpers/url_helper.rb | |
parent | c57e7239a8b82957bcb07534cb7c1a3dcef71864 (diff) | |
download | rails-1358fce5aa77982b8b7eabcad959e1799d420a2b.tar.gz rails-1358fce5aa77982b8b7eabcad959e1799d420a2b.tar.bz2 rails-1358fce5aa77982b8b7eabcad959e1799d420a2b.zip |
Make per form token work when method is not provided
When `button_to 'Botton', url` form was being used the per form token
was not correct because the method that is was being used to generate it
was an empty string.
Diffstat (limited to 'actionview/lib/action_view/helpers/url_helper.rb')
-rw-r--r-- | actionview/lib/action_view/helpers/url_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index 2454ed4ed4..ab67923376 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -312,7 +312,8 @@ module ActionView form_options[:'data-remote'] = true if remote request_token_tag = if form_method == 'post' - token_tag(nil, form_options: { action: url, method: method }) + request_method = method.empty? ? 'post' : method + token_tag(nil, form_options: { action: url, method: request_method }) else '' end |