Methods
R
W
Classes and Modules
Instance Public methods
raw_write_attribute(attr_name, value)

Alias for write_attribute

write_attribute(attr_name, value)

Updates the attribute identified by attr_name with the specified value. Empty strings for fixnum and float columns are turned into nil.

This method is also aliased as raw_write_attribute
    # File activerecord/lib/active_record/attribute_methods/write.rb, line 25
25:       def write_attribute(attr_name, value)
26:         attr_name = attr_name.to_s
27:         attr_name = self.class.primary_key if attr_name == 'id' && self.class.primary_key
28:         @attributes_cache.delete(attr_name)
29:         column = column_for_attribute(attr_name)
30: 
31:         unless column || @attributes.has_key?(attr_name)
32:           ActiveSupport::Deprecation.warn(
33:             "You're trying to create an attribute `#{attr_name}'. Writing arbitrary " \
34:             "attributes on a model is deprecated. Please just use `attr_writer` etc."
35:           )
36:         end
37: 
38:         @attributes[attr_name] = type_cast_attribute_for_write(column, value)
39:       end