Module: Mongo::Model::Crud
- Defined in:
- lib/mongo_db/model/crud.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #destroy(opts = {}) ⇒ Object
- #destroy!(*args) ⇒ Object
- #save(opts = {}) ⇒ Object
- #save!(*args) ⇒ Object
Instance Method Details
#destroy(opts = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/mongo_db/model/crud.rb', line 12 def destroy opts = {} with_collection opts do |collection, opts| collection.destroy self, opts end end |
#destroy!(*args) ⇒ Object
18 19 20 |
# File 'lib/mongo_db/model/crud.rb', line 18 def destroy! *args destroy(*args) || raise(Mongo::Error, "can't destroy #{self.inspect}!") end |
#save(opts = {}) ⇒ Object
2 3 4 5 6 |
# File 'lib/mongo_db/model/crud.rb', line 2 def save opts = {} with_collection opts do |collection, opts| collection.save self, opts end end |