class method
self.new
Ruby on Rails 5.0.7.2
Since v3.0.20Signature
self.new(base)
Pass in the instance of the object that is using the errors object.
class Person
def initialize
@errors = ActiveModel::Errors.new(self)
end
end
Parameters
-
basereq
Source
# File activemodel/lib/active_model/errors.rb, line 72
def initialize(base)
@base = base
@messages = apply_default_array({})
@details = apply_default_array({})
end
Defined in activemodel/lib/active_model/errors.rb line 72
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors