Module: MongoODM::Document::AttributeMethods::Write::InstanceMethods

Defined in:
lib/mongo_odm/document/attribute_methods/write.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) write_attribute(attr_name, value)



22
23
24
25
26
# File 'lib/mongo_odm/document/attribute_methods/write.rb', line 22

def write_attribute(attr_name, value)
  field = self.class.fields[attr_name]
  type = field ? field.type : value.class
  @attributes[attr_name] = attr_name.to_sym == :_id ? value : type.type_cast(value)
end