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
Source Code
# File active_resource/validations.rb, line 195 def size @errors.values.inject(0) { |error_count, attribute| error_count + attribute.size } end
<code/>and<pre/>for code samples.