aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorGeorgi Georgiev <gtqnchev@gmail.com>2017-12-02 20:45:10 +0200
committerGeorgi Georgiev <gtqnchev@gmail.com>2018-07-16 09:44:22 +0300
commit113d8a2ba39da13840845bac3aa4f274a1dae19b (patch)
tree02889c40f541e06bb2e2b48786c40109e8ede698 /actionview/lib
parentcd84d8716497010464cc2fb14f6ac9fe12b7efb7 (diff)
downloadrails-113d8a2ba39da13840845bac3aa4f274a1dae19b.tar.gz
rails-113d8a2ba39da13840845bac3aa4f274a1dae19b.tar.bz2
rails-113d8a2ba39da13840845bac3aa4f274a1dae19b.zip
Fix issue with `button_to`'s `to_form_params`
`button_to` was throwing exception when invoked with `params` hash that contains symbol and string keys. The reason for the exception was that `to_form_params` was comparing the given symbol and string keys. The issue is fixed by turning all keys to strings inside `to_form_params` before comparing them.
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/helpers/url_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb
index cae62f2312..52bffaab84 100644
--- a/actionview/lib/action_view/helpers/url_helper.rb
+++ b/actionview/lib/action_view/helpers/url_helper.rb
@@ -634,7 +634,7 @@ module ActionView
# suitable for use as the names and values of form input fields:
#
# to_form_params(name: 'David', nationality: 'Danish')
- # # => [{name: :name, value: 'David'}, {name: 'nationality', value: 'Danish'}]
+ # # => [{name: 'name', value: 'David'}, {name: 'nationality', value: 'Danish'}]
#
# to_form_params(country: { name: 'Denmark' })
# # => [{name: 'country[name]', value: 'Denmark'}]
@@ -666,7 +666,7 @@ module ActionView
params.push(*to_form_params(value, array_prefix))
end
else
- params << { name: namespace, value: attribute.to_param }
+ params << { name: namespace.to_s, value: attribute.to_param }
end
params.sort_by { |pair| pair[:name] }