aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorAna María Martínez Gómez <ammartinez@suse.de>2018-08-08 10:08:43 +0200
committerAna María Martínez Gómez <ammartinez@suse.de>2018-08-08 10:14:13 +0200
commita9764dcc07cf9d6280b313da734d98e096b7d122 (patch)
treef6c4d9fdcbb4d77640db9a159462c2442aaee3e3 /actionview
parent87b6e6aa4328f16edd68978079f473169cceecbd (diff)
downloadrails-a9764dcc07cf9d6280b313da734d98e096b7d122.tar.gz
rails-a9764dcc07cf9d6280b313da734d98e096b7d122.tar.bz2
rails-a9764dcc07cf9d6280b313da734d98e096b7d122.zip
Use public_send in extract_values_from_collection
Avoid exposing private methods in view's helpers. However, as `extract_values_from_collection` is only called from `options_from_collection_for_select` where `value_for_collection` is previously called, this case was already covered. The change makes anyway sense for consistency and in case the code changes in the future.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/form_options_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb
index 9c0238a01a..0fd68b66d4 100644
--- a/actionview/lib/action_view/helpers/form_options_helper.rb
+++ b/actionview/lib/action_view/helpers/form_options_helper.rb
@@ -794,7 +794,7 @@ module ActionView
def extract_values_from_collection(collection, value_method, selected)
if selected.is_a?(Proc)
collection.map do |element|
- element.send(value_method) if selected.call(element)
+ element.public_send(value_method) if selected.call(element)
end.compact
else
selected