Module: MongoMapper::Plugins::Rails::InstanceMethods
- Defined in:
- lib/mongo_mapper/plugins/rails.rb
Instance Method Summary collapse
- #new_record? ⇒ Boolean
- #read_attribute(name) ⇒ Object
- #read_attribute_before_typecast(name) ⇒ Object
- #to_key ⇒ Object
- #to_model ⇒ Object
- #to_param ⇒ Object
- #write_attribute(name, value) ⇒ Object
Instance Method Details
#new_record? ⇒ Boolean
22 23 24 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 22 def new_record? new? end |
#read_attribute(name) ⇒ Object
26 27 28 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 26 def read_attribute(name) self[name] end |
#read_attribute_before_typecast(name) ⇒ Object
30 31 32 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 30 def read_attribute_before_typecast(name) read_key_before_typecast(name) end |
#to_key ⇒ Object
18 19 20 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 18 def to_key [id] if persisted? end |
#to_model ⇒ Object
14 15 16 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 14 def to_model self end |
#to_param ⇒ Object
10 11 12 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 10 def to_param id.to_s if persisted? end |
#write_attribute(name, value) ⇒ Object
34 35 36 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 34 def write_attribute(name, value) self[name] = value end |