Skip to content

Conversation

@baweaver
Copy link

@baweaver baweaver commented Jan 9, 2025

While experimenting with this I figured it'd also be useful to count how many deletions are occurring, especially to make sure we know what's getting modified in rake tasks.

# The following will succeed:
#
# expect {
# WcRiskClass.last.update_attributes(id: 9999)
Copy link
Author

Choose a reason for hiding this comment

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

Need to fix that.

# The following will not succeed because the code destroys models:
#
# expect {
# WcRiskClass.last.destroy_attributes(id: 9999)
Copy link
Author

Choose a reason for hiding this comment

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

...and that

end

has_many :mock_posts
has_many :mock_posts, dependent: :destroy
Copy link
Author

Choose a reason for hiding this comment

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

Minor modification which only hits whenever deletions occur. Granted in a real app this is likely a bad idea, but for tests it seemed reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant