method

one?

Importance_1
v7.1.3.4 - Show latest stable - 0 notes - 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
Show source
Register or log in to add new notes.