You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something I didn't initially realize when using the new Rails/FindBy cop is that where(...).first is not equivalent to find_by in Rails 4+. The former orders by id by default (and maybe default_scope?), but the latter does not. It doesn't seem like the cop should autocorrect this case. It might not even make sense to match it at all, or if it does, then there should be a caveat about them not necessarily being equivalent.
The text was updated successfully, but these errors were encountered:
Yeah, you're totally right. I'm aware of the difference, but the problem is most people use where().first instead of where().take and they still don't care about the order. Maybe this was a mistake on my part and I should leave an auto-correct only for where().take.
Something I didn't initially realize when using the new Rails/FindBy cop is that
where(...).first
is not equivalent tofind_by
in Rails 4+. The former orders by id by default (and maybe default_scope?), but the latter does not. It doesn't seem like the cop should autocorrect this case. It might not even make sense to match it at all, or if it does, then there should be a caveat about them not necessarily being equivalent.The text was updated successfully, but these errors were encountered: