You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I found the root cause of the issue.
We are defining all mandatory attributes and only after it we are creating nested classes.
So, in this step -> https://github.com/davydovanton/shallow_attributes/blob/master/lib/shallow_attributes/type.rb#L80
we have mandatory attributes for User, but we call .new without args and it threw an exception.
I haven't ideas how to fix it properly, just thoughts.
We have two ways:
@X1ting – nice find. To be honest, I'm not sure I fully understand the impact, but your option (2) sounds like it makes the most sense and is in line with how shallow_attributes expects objects to be initialised (i.e. all required data must be provided at object initialisation). Having the nested objects initialised in the same way makes a lot of sense.
Let me know if there's something I can help further with.
Hi – firstly, thank you for this library!
I've noticed that using
present: true
on embedded values throws an error (seemingly every time).To reproduce: if you add
, present: true
toshallow_attributes/test/custom_types_test.rb
Line 6 in 9a9c55e
I may be able to take a closer look and work on a PR when I have more time; any pointers are gladly welcome.
The text was updated successfully, but these errors were encountered: