instance method
count
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v6.0.6Signature
count()
Returns the number of error messages.
p.errors.add(:name, "can't be blank") p.errors.count # => 1 p.errors.add(:name, "must be specified") p.errors.count # => 2
Source
# File activemodel/lib/active_model/errors.rb, line 143
def count
to_a.size
end
Defined in activemodel/lib/active_model/errors.rb line 143
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors