Module: MongoMapper::Plugins::Querying

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

Defined Under Namespace

Modules: ClassMethods Classes: DecoratedPluckyQuery

Constant Summary

Methods =
Plucky::Methods + [:delete, :delete_all, :destroy, :destroy_all, :find!]

Instance Method Summary collapse

Instance Method Details

#deleteObject



115
116
117
# File 'lib/mongo_mapper/plugins/querying.rb', line 115

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

#destroyObject



111
112
113
# File 'lib/mongo_mapper/plugins/querying.rb', line 111

def destroy
  delete
end

#save(options = {}) ⇒ Object



101
102
103
104
# File 'lib/mongo_mapper/plugins/querying.rb', line 101

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

#save!(options = {}) ⇒ Object



106
107
108
109
# File 'lib/mongo_mapper/plugins/querying.rb', line 106

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