Skip to content
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

.really_destroy! should not destroy has_many :through records #467

Open
wants to merge 1 commit into
base: core
Choose a base branch
from

Conversation

atd
Copy link

@atd atd commented Mar 8, 2019

Despite of counter intuitive, Rails API states that has_many :through records must not be destroyed, but their associations https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_many

If using with the :through option, the association on the join model must be a belongs_to, and the records which get deleted are the join records, rather than the associated records.

paranoia should have the same behavior

Fixes #466

Copy link
Collaborator

@mathieujobin mathieujobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that current tests pass https://github.com/rubysherpas/paranoia/actions/runs/2026327334

But I would like to see a test case added for this and few more people advocating for this to be merged before taking side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.really_destroy! should not destroy has_many :through records
2 participants