module MongoMapper::Plugins::Rails
Public Instance Methods
new_record?()
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 20 def new_record? new? end
read_attribute(name)
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 24 def read_attribute(name) self[name] end
read_attribute_before_type_cast(name)
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 28 def read_attribute_before_type_cast(name) @__mm_pre_cast ||= {} name = unalias_key name if !@__mm_pre_cast.key?(name) @__mm_pre_cast[name] = read_attribute(name) end @__mm_pre_cast[name] end
to_key()
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 16 def to_key [id] if persisted? end
to_model()
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 12 def to_model self end
to_param()
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 8 def to_param id.to_s if persisted? end
write_attribute(name, value)
click to toggle source
# File lib/mongo_mapper/plugins/rails.rb, line 37 def write_attribute(name, value) self[name] = value self[name] end
write_key(name, value)
click to toggle source
Calls superclass method
# File lib/mongo_mapper/plugins/rails.rb, line 42 def write_key(name, value) name = unalias_key name @__mm_pre_cast ||= {} @__mm_pre_cast[name.to_s] = value super end