method
size
v2.2.1 -
Show latest stable
- Class:
ActiveResource::Errors
size()public
Returns the total number of errors added. Two errors added to the same attribute will be counted as such with this as well.
Examples
my_person = Person.new(params[:person]) my_person.errors.size # => 0 my_person.errors.add('login', 'can not be empty') if my_person.login == '' my_person.errors.add('password', 'can not be empty') if my_person.password == '' my_person.error.size # => 2