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

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

Instance Method Summary collapse

Instance Method Details

#new_record?Boolean

Returns:



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

def new_record?
  new?
end

#read_attribute(name) ⇒ Object



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

def read_attribute(name)
  self[name]
end

#read_attribute_before_type_cast(name) ⇒ Object



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

def read_attribute_before_type_cast(name)
  read_key_before_type_cast(name)
end

#to_keyObject



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

def to_key
  [id] if persisted?
end

#to_modelObject



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

def to_model
  self
end

#to_paramObject



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

def to_param
  id.to_s if persisted?
end

#write_attribute(name, value) ⇒ Object



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

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