instance method
errors
Ruby on Rails 7.2.3
Since v2.2.3Signature
errors()
Returns the Errors object that holds all information about attribute error messages.
class Person include ActiveModel::Validations attr_accessor :name validates_presence_of :name end person = Person.new person.valid? # => false person.errors # => #<ActiveModel::Errors:0x007fe603816640 @messages={name:["can't be blank"]}>
Source
# File activemodel/lib/active_model/validations.rb, line 332
def errors
@errors ||= Errors.new(self)
end
Defined in activemodel/lib/active_model/validations.rb line 332
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Validations