mobility icon indicating copy to clipboard operation
mobility copied to clipboard

Include query_scope in find_by methods

Open shioyama opened this issue 5 years ago • 2 comments

It makes sense to include the query scope automatically in the find_by methods (find_by_title etc) so they work out of the box.

Assume title is a translated attribute:

Before

Post.i18n.find_by_title('foo')
#=> <Post ...>
Post.find_by_title('foo')
#=> ActiveRecord::StatementInvalid ...

After

Post.i18n.find_by_title('foo')
#=> <Post ...>
Post.find_by_title('foo')
#=> <Post ...>

shioyama avatar Dec 20 '20 12:12 shioyama

Would be nice to merge this! @shioyama

madhums avatar Feb 05 '24 08:02 madhums