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

Overriding Rails boolean methods #1

Open
dansingerman opened this issue Nov 22, 2022 · 0 comments
Open

Overriding Rails boolean methods #1

dansingerman opened this issue Nov 22, 2022 · 0 comments

Comments

@dansingerman
Copy link

If you have a boolean field visible on a model, and a visible scope, this will override the visible? method rails gives you by default, and hit the database to find out the answer.

This is fine mostly, but if you are doing logic on dirty attributes (e.g. in a validation method) this means the value of visible and visible? can give you different answers

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

No branches or pull requests

1 participant