module ActiveRecord::FinderMethods

def find_by(*args)

Post.find_by "published_at < ?", 2.weeks.ago
Post.find_by name: 'Spartacus', rating: 4

If no record is found, returns nil.

yourself.
is no implied ordering so if order matters, you should specify it
Finds the first record matching the specified conditions. There
def find_by(*args)
  where(*args).take
end