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

ActiveRecord: Recommend column? instead of column.present? #149

Closed
grosser opened this issue Nov 3, 2019 · 1 comment
Closed

ActiveRecord: Recommend column? instead of column.present? #149

grosser opened this issue Nov 3, 2019 · 1 comment

Comments

@grosser
Copy link
Contributor

grosser commented Nov 3, 2019

All activerecord columns have ? methods which check their presence, encourage to use them.

user.name.present? # bad
user.name? # good
@koic koic mentioned this issue Sep 16, 2020
20 tasks
@koic
Copy link
Member

koic commented Apr 27, 2021

I like the idea! But a static analysis tool RuboCop cannot determine whether it is an AR attribute or not. I was feedback to RuboCop Typed that is a project trying it.
pocke/rubocop-typed#2

Anyway, I think it can be suggested to the Rails style guide. Thank you.
https://github.com/rubocop/rails-style-guide

@koic koic closed this as completed Apr 27, 2021
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

2 participants