Module: MongoMapper::Plugins::Querying

Extended by:
ActiveSupport::Concern
Included in:
Document
Defined in:
lib/mongo_mapper/plugins/querying.rb,
lib/mongo_mapper/plugins/querying/decorator.rb

Defined Under Namespace

Modules: ClassMethods, Decorator

Constant Summary collapse

Methods =
Plucky::Methods + [:find!]

Instance Method Summary collapse

Instance Method Details

#deleteObject



141
142
143
# File 'lib/mongo_mapper/plugins/querying.rb', line 141

def delete
  self.class.delete(id).tap { @_destroyed = true } if persisted?
end

#destroyObject



137
138
139
# File 'lib/mongo_mapper/plugins/querying.rb', line 137

def destroy
  delete
end

#save(options = {}) ⇒ Object



127
128
129
130
# File 'lib/mongo_mapper/plugins/querying.rb', line 127

def save(options={})
  options.assert_valid_keys(:validate, :safe)
  create_or_update(options)
end

#save!(options = {}) ⇒ Object



132
133
134
135
# File 'lib/mongo_mapper/plugins/querying.rb', line 132

def save!(options={})
  options.assert_valid_keys(:safe)
  save(options) || raise(DocumentNotValid.new(self))
end