reform-rails
reform-rails copied to clipboard
fix infinite loop by parent attr
Thanks @kmsheng :green_heart: could you kindly add a test that provokes this bug, or give us an idea how you ran into this? We can help adding the formal test.
@apotonick Sure, my pleasure
@apotonick Please take a look at https://github.com/trailblazer/reform-rails/pull/95/commits/1396f357f27f7e8881173b15dee5d2a549698e82 ,this test would fail at master branch.
And the error would be thrown as
Error:
ParentTest#test_0001_allows nested collection validation messages to be shown:
SystemStackError: stack level too deep
lib/reform/form/active_model.rb:92:in `new'
lib/reform/form/active_model.rb:92:in `active_model_name_for'
lib/reform/form/active_model.rb:87:in `model_name'
lib/reform/form/active_model/validations.rb:31:in `block in active_model_really_sucks'
lib/reform/form/active_model/validations.rb:30:in `active_model_really_sucks'
lib/reform/form/active_model/validations.rb:170:in `full_messages'
lib/reform/form/active_model/validations.rb:195:in `get_amv_errors'
lib/reform/form/active_model/validations.rb:191:in `block in get_collection_errors'
lib/reform/form/active_model/validations.rb:191:in `map'
lib/reform/form/active_model/validations.rb:191:in `get_collection_errors'
lib/reform/form/active_model/validations.rb:184:in `full_messages_for_twin'
lib/reform/form/active_model/validations.rb:180:in `block in full_messages_for_nested_fields'
lib/reform/form/active_model/validations.rb:180:in `each'
lib/reform/form/active_model/validations.rb:180:in `map'
lib/reform/form/active_model/validations.rb:180:in `full_messages_for_nested_fields'
lib/reform/form/active_model/validations.rb:172:in `full_messages'
lib/reform/form/active_model/validations.rb:195:in `get_amv_errors'
lib/reform/form/active_model/validations.rb:185:in `full_messages_for_twin'
lib/reform/form/active_model/validations.rb:180:in `block in full_messages_for_nested_fields'