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

Stop enforcing to have a default value in ThreeStateBooleanColumn #987

Closed
shouichi opened this issue Apr 20, 2023 · 2 comments
Closed

Stop enforcing to have a default value in ThreeStateBooleanColumn #987

shouichi opened this issue Apr 20, 2023 · 2 comments

Comments

@shouichi
Copy link

Is your feature request related to a problem? Please describe.

A not-null constraint is enough to prevent three states in a boolean column. Enforcing to have a default value feels too restrictive. Some apps might want to set values explicitly in ruby.

Describe the solution you'd like

Stop enforcing to have a default value in ThreeStateBooleanColumn.

Describe alternatives you've considered

Additional context

@koic
Copy link
Member

koic commented Apr 20, 2023

This cop behavior is based on https://rails.rubystyle.guide/#three-state-boolean. If the default behavior is hard to use, please suggest it to the style guide.

If RuboCop Rails provides a new option like RequireDefaultValue: false, it is synonymous with Rails/NotNullColumn. So if you don't like it, just disable Rails/ThreeStateBooleanColumn.

@koic koic closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2023
@dgmora
Copy link

dgmora commented Feb 3, 2025

I've seen the discussion in rubocop/rails-style-guide#363. Would you consider not enforcing the default for create_table ?

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

3 participants