method
find_one
v5.2.3 -
Show latest stable
- Class:
ActiveRecord::FinderMethods
find_one(id)private
No documentation available.
# File activerecord/lib/active_record/relation/finder_methods.rb, line 445
def find_one(id)
if ActiveRecord::Base === id
raise ArgumentError, You are passing an instance of ActiveRecord::Base to `find`. Please pass the id of the object by calling `.id`..squish
end
relation = where(primary_key => id)
record = relation.take
raise_record_not_found_exception!(id, 0, 1) unless record
record
end