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
Contrary to what you'd expect, association information is always contained on the object specifying the association, even if it seems like the association has a foreign key. This is a side effect of DynamoDB's structure: it's very difficult to find foreign keys without an index. Usually you won't find this to be a problem, but it does mean that association methods that build new models will not work correctly - for example, user.addresses.new returns an address that is not associated to the user. We'll be correcting this soon maybe someday, if we get a pull request.
👨💻 On the code, I decided to give it a try and it seems to work. E.g:
I believe the issue still exists and it's related to association between persisted model and not persisted yet model. In your examples all the models are persisted that's why it works well.
Actually the documentation isn't accurate and there is no new method for has_many association so the example user.addresses.new doesn't work. There is a method << which adds a model to an association but it looks like it cannot add a not-persisted model.
Let's sum up. The mentioned issue exists and warning in documentation still actual but the documentation is not accurate.
Hi! 👋
On the documentation it states the following:
👨💻 On the code, I decided to give it a try and it seems to work. E.g:
Model:
The text was updated successfully, but these errors were encountered: