class Address
include ShallowAttributes
attribute :street, String
end
class Person
include ShallowAttributes
attribute :name, String
attribute :address, Address
end
... when the embedded class receives parameters that doesn't match the defined attributes:
... an error raises because doesn't find the definition in the class.
When a class including ShallowAttribues is initialized, during the initialization parameters non matching attributes are dismissed. But it doesn't happen during the lower levels in the hierarchy, because the objects are creating according to the type.
SOLUTION
Adding some logic during the type coercion and initialization avoid the conflict.
Coverage increased (+0.003%) to 99.781% when pulling c4c8b43af52cf8d9cc41f0207ccc786b3926da8c on LemontechSA:fix-nested-shallow-attributes-with-unexpected-parameters into 51f5c1b017e6d389446a87bf02598fee844605fd on davydovanton:master.
Coverage increased (+0.005%) to 99.784% when pulling 80990d91671b2ca5005eca0a06090bc6411171ae on LemontechSA:fix-nested-shallow-attributes-with-unexpected-parameters into 51f5c1b017e6d389446a87bf02598fee844605fd on davydovanton:master.
PROBLEM
Having two classes related like follow:
... when the embedded class receives parameters that doesn't match the defined attributes:
... an error raises because doesn't find the definition in the class.
When a class including
ShallowAttribues
is initialized, during the initialization parameters non matching attributes are dismissed. But it doesn't happen during the lower levels in the hierarchy, because the objects are creating according to the type.SOLUTION
Adding some logic during the
type
coercion and initialization avoid the conflict.