Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87b6e6a

Browse files
committed
Use public_send in value_for_collection
Avoid exposing private methods in view's helpers.Fixes#33546
1 parentb9807eb commit87b6e6a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

‎actionview/CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
* Stop exposing public methods in view's helpers.
2+
3+
For example, in methods like`options_from_collection_for_select`,
4+
it was possible to call private methods from the objects used.
5+
6+
See[#33546](https://github.com/rails/rails/issues/33546) for details.
7+
8+
*[Ana María Martínez Gómez](https://github.com/Ana06)*
9+
10+
111
* Fix issue with`button_to`'s`to_form_params`
212

313
`button_to` was throwing exception when invoked with`params` hash that

‎actionview/lib/action_view/helpers/form_options_helper.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def extract_values_from_collection(collection, value_method, selected)
802802
end
803803

804804
defvalue_for_collection(item,value)
805-
value.respond_to?(:call) ?value.call(item) :item.send(value)
805+
value.respond_to?(:call) ?value.call(item) :item.public_send(value)
806806
end
807807

808808
defprompt_text(prompt)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp