There is a 'small' difference between where and find_by.
find_by will return just one record if found otherwise it will be nil.
Finds the first record matching the specified conditions. There is no implied ordering so if order matters, you should specify it yourself.
If no record is found, returns nil.
def find_by(*args)
where(*args).take
rescue RangeError
nil
end
meanwhile where it will return an relation
Returns a new relation, which is the result of filtering the current relation
according to the conditions in the arguments.