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_type_cast(name) ⇒ Object
- #to_key ⇒ Object
- #to_model ⇒ Object
- #to_param ⇒ Object
- #write_attribute(name, value) ⇒ Object
Instance Method Details
#new_record? ⇒ Boolean
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_key ⇒ Object
16 17 18 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 16 def to_key [id] if persisted? end |
#to_model ⇒ Object
12 13 14 |
# File 'lib/mongo_mapper/plugins/rails.rb', line 12 def to_model self end |
#to_param ⇒ Object
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 |