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

Some query parameter can be removed due to the constraints. #8075

Open
jwjwyoung opened this issue Nov 28, 2019 · 1 comment
Open

Some query parameter can be removed due to the constraints. #8075

jwjwyoung opened this issue Nov 28, 2019 · 1 comment

Comments

@jwjwyoung
Copy link

jwjwyoung commented Nov 28, 2019

@created_users = User.where("username IS NOT NULL and created_at IS NOT NULL")

the username is not null is not needed since there is already in user.rb which denotes that username will not be null.
validates :username, :presence => true, :uniqueness => true

Also, in migrate file, it denotes created_at will not be null,

t.datetime :created_at, null: false
.

As a result, this query can be simplified to User.all to save the query time on the two paramater.

@jwjwyoung
Copy link
Author

I have submitted a pull request #8076.

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

No branches or pull requests

2 participants