Method: ActiveRecord::FinderMethods#find_by!

Defined in:
activerecord/lib/active_record/relation/finder_methods.rb

#find_by!(arg, *args) ⇒ Object

Like #find_by, except that if no record is found, raises an ActiveRecord::RecordNotFound error.


86
87
88
# File 'activerecord/lib/active_record/relation/finder_methods.rb', line 86

def find_by!(arg, *args)
  where(arg, *args).take!
end