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

Warn if acts_as_paranoid is called more than once on the same model #492

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

ignatiusreza
Copy link
Contributor

which will breaks the method aliasing of #destroy and makes them lost
access to the original one defined by ActiveRecord

fix #489

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.

This seems like a good idea... I wonder if my huge platform would be bitten by this...
I'd be temped to switch the puts for a raise if Rails.env.test?
anyone else have an opinion on this?

I could include it in an upcoming release.
but needs version bump, changelog updated and rebased with core for tests to run.

@ignatiusreza ignatiusreza changed the title warn user if they call acts_as_paranoid more than once on the same model Warn if acts_as_paranoid is called more than once on the same model Jan 19, 2022
@ignatiusreza ignatiusreza force-pushed the double-paranoia branch 2 times, most recently from ffd2eeb to 36bf837 Compare January 19, 2022 20:22
which will breaks the method aliasing of `#destroy` and makes them lost
access to the original one defined by ActiveRecord
@ignatiusreza
Copy link
Contributor Author

I rebased and added changelog

Given that paranoia is designed to be usable with activerecord outside of rails, I'm not quite sure how to best check for the rails environment. Any advice?

@mathieujobin mathieujobin merged commit c0758a8 into rubysherpas:core Feb 2, 2022
@ignatiusreza ignatiusreza deleted the double-paranoia branch February 2, 2022 06:28
@mathieujobin
Copy link
Collaborator

to answer your last question @ignatiusreza

I recommend doing if defined?(Rails)

karunkumar1ly pushed a commit to edcast/paranoia that referenced this pull request Feb 6, 2024
…ubysherpas#492)

which will breaks the method aliasing of `#destroy` and makes them lost
access to the original one defined by ActiveRecord
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.

double acts_as_paranoid by mistake
2 participants