instance method
each_full
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
each_full()
Yields each full error message added. So Person.errors.add("first_name", "can't be empty") will be returned through iteration as “First name can’t be empty”.
class Company < ActiveRecord::Base validates_presence_of :name, :address, :email validates_length_of :name, :in => 5..30 end company = Company.create(:address => '123 First St.') company.errors.each_full{|msg| puts msg } # => Name is too short (minimum is 5 characters) # Name can't be blank # Address can't be blank
Source
# File activerecord/lib/active_record/validations.rb, line 271
def each_full
full_messages.each { |msg| yield msg }
end
Defined in activerecord/lib/active_record/validations.rb line 271
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Errors