Module: MongoModel::AttributeMethods::Write

Extended by:
ActiveSupport::Concern
Included in:
EmbeddedDocument
Defined in:
lib/mongomodel/concerns/attribute_methods/write.rb

Instance Method Summary collapse

Instance Method Details

#[]=(name, value) ⇒ Object

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



18
19
20
# File 'lib/mongomodel/concerns/attribute_methods/write.rb', line 18

def []=(name, value)
  write_attribute(name, value)
end

#write_attribute(name, value) ⇒ Object

Updates the attribute identified by name with the specified value. Values are typecast to the appropriate type determined by the property.



12
13
14
# File 'lib/mongomodel/concerns/attribute_methods/write.rb', line 12

def write_attribute(name, value)
  attributes[name.to_sym] = value
end