instance method
[]=
Ruby on Rails edge
Since v4.0.13Signature
[]=(attr_name, value)
Updates the attribute identified by attr_name using the specified value. The attribute value will be type cast upon being read.
“‘ class Person < ActiveRecord::Base end
person = Person.new person = “2004-12-12” person # => Date.new(2004, 12, 12) “‘
Parameters
-
attr_namereq -
valuereq
Source
# File activerecord/lib/active_record/attribute_methods.rb, line 489
def []=(attr_name, value)
write_attribute(attr_name, value)
end
Defined in activerecord/lib/active_record/attribute_methods.rb line 489
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods