instance method
[]=
Ruby on Rails 4.2.9
Since v2.2.3 Last seen in v4.2.9Signature
[]=(attribute, error)
Adds to the supplied attribute the supplied error message.
person.errors[:name] = "must be set" person.errors[:name] # => ['must be set']
Parameters
-
attributereq -
errorreq
Source
# File activemodel/lib/active_model/errors.rb, line 143
def []=(attribute, error)
self[attribute] << error
end
Defined in activemodel/lib/active_model/errors.rb line 143
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Errors