method
one?
rails 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