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
after_callback is not called on nested resources #22943
Comments
@xdmx can you check whether the records have been saved to the database before the rollback occurs. I think what's happening is that the nested records are only in memory and so haven't been added to the transaction yet. |
@pixeltrix from the rails log I see only SELECT queries called by validations before and after the ROLLBACK, but none with INSERT or UPDATE So far I've solved it with the following:
Which is not the best way but it does the work |
@xdmx was there an insert/update for the top level model? |
nope, only selects in the log after running (which failed some validations on the nested record)
|
@xdmx can you make it so the top level model passes validation and then the transaction fails because of a validation failure on a nested model. Also what database are you using? |
Yup, it was already like that, the top level model (user) was valid, and the nested model (post) was not I'm using postgresql 9.4.5 under Arch linux |
This issue has been automatically marked as stale because it has not been commented on for at least The resources of the Rails team are limited, and so we are asking for your help. If you can still reproduce this error on the Thank you for all your contributions. |
This issue has been automatically closed because of inactivity. If you can still reproduce this error on the Thank you for all your contributions. |
I'm using rails 4.2.5 and I've noticed that after_callback is not called on nested resources
When a user is created passing posts_attributes, it only puts
top level
, but notnested
In my opinion it should also call the nested rollback, since it could be do something important
The text was updated successfully, but these errors were encountered: