Module: MassiveRecord::ORM::AttributeMethods::Write

Extended by:
ActiveSupport::Concern
Defined in:
lib/massive_record/orm/attribute_methods/write.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#write_attribute(attr_name, value) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/massive_record/orm/attribute_methods/write.rb', line 30

def write_attribute(attr_name, value)
  attr_name = attr_name.to_s
  internal_write_method = "_#{attr_name}="

  if respond_to? internal_write_method
    send(internal_write_method, value)
  else
    @attributes[attr_name.to_s] = value
  end
end