-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC - model save hooks and mobility #574
Comments
@shioyama I managed to isolate the behavior into a failing mobility spec: Basically, if translates is not done before declaring model after_* hooks, it is possible to not get the translated attribute inside a hook (on an associated model that is). It seems that ActiveRecord will run the hooks before persisting the associations, leading to this issue, as in this case the associated model will fetch the main model from DB and it will not find the translations. |
Just glancing at this I doubt this is something that can be fixed very easily. |
Yeah it seems so :( |
There seems to be an issue with attr readers in some configuration of model after_create/save hooks. See also original issue mrbrdo/spree_mobility#6
Code triggering the issue (in Spree project if you are familiar):
At some point here, Taxon's name (for translation) is set to nil, although a non-nil value was given to base model. It has something to do with the save hooks, it seems. Since I have a validation on the translation model's name presence, the validation fails. Do you have any idea what could be the issue here?
The text was updated successfully, but these errors were encountered: