Class: Machinist::MongoMapper::Blueprint
- Inherits:
-
Blueprint
- Object
- Blueprint
- Machinist::MongoMapper::Blueprint
- Defined in:
- lib/machinist/mongo_mapper/blueprint.rb
Instance Method Summary collapse
-
#box(object) ⇒ Object
Box an object for storage in the warehouse.
-
#lathe_class ⇒ Object
:nodoc:.
-
#make!(attributes = {}) ⇒ Object
Make and save an object.
- #outside_transaction ⇒ Object
-
#unbox(id) ⇒ Object
Unbox an object from the warehouse.
Instance Method Details
#box(object) ⇒ Object
Box an object for storage in the warehouse.
13 14 15 |
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 13 def box(object) object.id end |
#lathe_class ⇒ Object
:nodoc:
26 27 28 |
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 26 def lathe_class #:nodoc: Machinist::MongoMapper::Lathe end |
#make!(attributes = {}) ⇒ Object
Make and save an object.
5 6 7 8 9 10 |
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 5 def make!(attributes = {}) object = make(attributes) raise NoMethodError, "Embedded Objects cannot be make! ed" if object.class. object.save! object.reload end |
#outside_transaction ⇒ Object
22 23 24 |
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 22 def outside_transaction yield end |
#unbox(id) ⇒ Object
Unbox an object from the warehouse.
18 19 20 |
# File 'lib/machinist/mongo_mapper/blueprint.rb', line 18 def unbox(id) @klass.find(id) end |