Flowdock
method

size

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