Skip to content

Commit

Permalink
Merge branch 'tags-public-send'
Browse files Browse the repository at this point in the history
Fixes #14180
Fixes #17461
  • Loading branch information
rafaelfranca committed Oct 31, 2014
2 parents ecb3113 + 0d6a56d commit c1a118a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionview/lib/action_view/helpers/tags/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def render
private

def value(object)
object.send @method_name if object
object.public_send @method_name if object
end

def value_before_type_cast(object)
Expand Down
14 changes: 14 additions & 0 deletions actionview/test/template/form_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1785,6 +1785,20 @@ def test_form_for_with_symbol_object_name
assert_dom_equal expected, output_buffer
end

def test_form_tags_do_not_call_private_properties_on_form_object
obj = Class.new do
private

def private_property
raise "This method should not be called."
end
end.new

form_for(obj, as: "other_name", url: '/', html: { id: "edit-other-name" }) do |f|
assert_raise(NoMethodError) { f.hidden_field(:private_property) }
end
end

def test_form_for_with_method_as_part_of_html_options
form_for(@post, url: '/', html: { id: 'create-post', method: :delete }) do |f|
concat f.text_field(:title)
Expand Down

0 comments on commit c1a118a

Please sign in to comment.