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
Refs #28025 nullify *_type column on polymorphic associations on :nu… #28078
Refs #28025 nullify *_type column on polymorphic associations on :nu… #28078
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @eileencodes (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. |
c7b881d
to
12b81b8
Compare
Nice! I think this needs to be extended to handle to polymorphic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
activerecord/test/cases/associations/has_many_associations_test.rb
Outdated
Show resolved
Hide resolved
activerecord/lib/active_record/associations/has_many_association.rb
Outdated
Show resolved
Hide resolved
activerecord/lib/active_record/associations/has_many_association.rb
Outdated
Show resolved
Hide resolved
da151d8
to
4940d90
Compare
@gmcgibbon @haines thanks for the feedback. I made some changes can you have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding it to the has_one
, this looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! Please squash your commits and add a changelog entry in activerecord/CHANGELOG
to make this mergeable.
activerecord/lib/active_record/associations/nullified_owner_attributes.rb
Outdated
Show resolved
Hide resolved
4940d90
to
df85d55
Compare
@gmcgibbon thank you for the feedback. Squashed and updated CHANGELOG / docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, two more things and then it should be good to go!
df85d55
to
17d2993
Compare
@gmcgibbon Updated. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Sorry for the delay @laertispappas - can you fix the conflicts and I can merge once that's done.
activerecord/lib/active_record/associations/nullified_owner_attributes.rb
Outdated
Show resolved
Hide resolved
17d2993
to
e5a9774
Compare
@eileencodes @kamipo thanks for the feedback. I've made some changes. |
acf4f37
to
f2c7614
Compare
49b180a
to
bdf59e5
Compare
…r :nullify deletion strategy
bdf59e5
to
105f6f6
Compare
105f6f6
to
78bb689
Compare
Thanks! |
Pleasure |
Nullify polymorphic *_type column on dependent: :nullify strategy.
Summary
This PR addresses the issue described in #28025. On
dependent: :nullify
strategy only the foreign key of the relation is nullified. However on polymorphic associations the*_type
column is not nullified leaving the record with a NULL*_id
but the*_type
column is present.