Fix nested fields_for when Hash-based model is passed. #1778

Merged
merged 2 commits into from Jun 22, 2011

2 participants

@spohlenz

This fixes an error when a record object that is a subclass of Hash is passed to fields_for, which is incorrectly interpreted as field options.

@spohlenz spohlenz Test for extractable_options? within nested fields_for.
This fixes an error when a record object that is a subclass of Hash is
passed to fields_for, which is incorrectly interpreted as field options.
e69eed0
@josevalim josevalim commented on the diff Jun 20, 2011
actionpack/test/template/form_helper_test.rb
@@ -1689,6 +1689,24 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal expected, output_buffer
end
+ def test_nested_fields_for_with_hash_like_model
@josevalim
Ruby on Rails member
josevalim added a line comment Jun 20, 2011

Why not a use a hash in the test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@spohlenz

I've updated the test to use a real hash-based model rather than a stubbed out one.

@josevalim josevalim merged commit 3c8c379 into rails:master Jun 22, 2011
@sterrym sterrym pushed a commit to sterrym/formtastic that referenced this pull request Jan 31, 2014
@justinfrench justinfrench Fix bug when simple_fields_for is used with a hask like model
Thanks to @rafaelfranca and @spohlenz fixing in simple_form and Rails!

See:
plataformatec/simple_form@14b6263
rails/rails#1778

ref #568
131f350
@sideci-sample sideci-sample pushed a commit to sideci-sample/sideci-sample-simple_form that referenced this pull request Apr 23, 2014
@rafaelfranca rafaelfranca Fix bug when simple_fields_for is used with a hask like model and imp…
…rove coverage.

Thanks to https://github.com/spohlenz for figuring this out in the Rails code.
See more: rails/rails#1778
14b6263
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment