Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Skip the need to type select #447

Open
confact opened this issue May 25, 2021 · 1 comment
Open

Skip the need to type select #447

confact opened this issue May 25, 2021 · 1 comment

Comments

@confact
Copy link

confact commented May 25, 2021

When I run Model.where(name: "confact").first.. it complains.

I have to type: Model.where(name: "confact").select.first... do get it to work.

@crimson-knight
Copy link
Member

This is a worthy convenience method. It appears that the where just isn't evaluated when the first method is chained. I think it makes sense for this to be a convenience method, but there's also find_by that can take the attribute name and value and just return the single object if found.

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

No branches or pull requests

3 participants