granite icon indicating copy to clipboard operation
granite copied to clipboard

Skip the need to type `select`

Open confact opened this issue 4 years ago • 1 comments

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.

confact avatar May 25 '21 06:05 confact

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.

crimson-knight avatar Apr 25 '23 12:04 crimson-knight