method
one?
v7.1.3.4 -
Show latest stable
- Class:
ActiveRecord::Relation
one?(*args)public
Returns true if there is exactly one record.
When a pattern argument is given, this method checks whether elements in the Enumerable match the pattern via the case-equality operator (===).
posts.one?(Post) # => true or false