module ActiveRecord::AttributeMethods

def []=(attr_name, value)

person[:age].class # => Integer
person[:age] # => 22
person[:age] = '22'
person = Person.new

end
class Person < ActiveRecord::Base

(Alias for the protected #write_attribute method).
Updates the attribute identified by attr_name with the specified +value+.
def []=(attr_name, value)
  write_attribute(attr_name, value)
end