Module: MongoMapper::Plugins::Rails::InstanceMethods

Defined in:
lib/mongo_mapper/plugins/rails.rb

Instance Method Summary collapse

Instance Method Details

#new_record?Boolean

Returns:



21
22
23
# File 'lib/mongo_mapper/plugins/rails.rb', line 21

def new_record?
  new?
end

#read_attribute(name) ⇒ Object



25
26
27
# File 'lib/mongo_mapper/plugins/rails.rb', line 25

def read_attribute(name)
  self[name]
end

#read_attribute_before_typecast(name) ⇒ Object



29
30
31
# File 'lib/mongo_mapper/plugins/rails.rb', line 29

def read_attribute_before_typecast(name)
  read_key_before_typecast(name)
end

#to_keyObject



17
18
19
# File 'lib/mongo_mapper/plugins/rails.rb', line 17

def to_key
  [id] if persisted?
end

#to_modelObject



13
14
15
# File 'lib/mongo_mapper/plugins/rails.rb', line 13

def to_model
  self
end

#to_paramObject



9
10
11
# File 'lib/mongo_mapper/plugins/rails.rb', line 9

def to_param
  id.to_s if persisted?
end

#write_attribute(name, value) ⇒ Object



33
34
35
# File 'lib/mongo_mapper/plugins/rails.rb', line 33

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