Allow subclasses to redefine autosave callbacks for associated records - #33378
Conversation
|
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review. Please see the contribution instructions for more information. |
bogdanvlviv
left a comment
There was a problem hiding this comment.
Thanks.
Could you please fix rubocop issues in https://codeclimate.com/github/rails/rails/pull/33378?
There was a problem hiding this comment.
Missing dot after #33305
There was a problem hiding this comment.
IN => In. I would also add suffix WithAcceptsNestedAttributes.
There was a problem hiding this comment.
Could you change order of arguments since assert_equal receive expected value as first argument and actual values as the second.
It would improve error message:
Expected: "Initial"
Actual: "Updated"
There was a problem hiding this comment.
Could you change the order of arguments since assert_equal receive an expected value as the first argument and an actual values as the second.
It would improve error message:
Expected: "Initial"
Actual: "Updated"
There was a problem hiding this comment.
@bogdanvlviv Sure. Can i squash commits into one after?
|
Could you squash commits into one? |
c27adf7 to
a6aabf4
Compare
There was a problem hiding this comment.
Not sure, but maybe it would be better to move this class definition to activerecord/test/models/company.rb
There was a problem hiding this comment.
Actually, I'm not sure too. This specific class used in this specific place only. It should be useless in other cases. Especially when activerecord/test/models/company.rb full of other classes.
Also maybe i should move this spec to activerecord/test/cases/nested_attributes_test.rb?
a6aabf4 to
3e271dc
Compare
3e271dc to
35ee756
Compare
…lbacks Allow subclasses to redefine autosave callbacks for associated records
Allow subclasses to redefine autosave callbacks for associated records rails/rails#33378
Summary
This addresses this issue #33305
AutosaveAssociationskip creation of callback method if it's already defined (even in parent class).