[]=(attr_name, value) public

Updates the attribute identified by attr_name with the specified value. (Alias for the protected write_attribute method).

class Person < ActiveRecord::Base
end

person = Person.new
person[:age] = '22'
person[:age] # => 22
person[:age].class # => Integer
Show source
Register or log in to add new notes.