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,
lib/mongo_mapper/plugins/querying/plucky_methods.rb

Defined Under Namespace

Modules: ClassMethods, Decorator, PluckyMethods

Instance Method Summary collapse

Instance Method Details

#deleteObject



147
148
149
# File 'lib/mongo_mapper/plugins/querying.rb', line 147

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

#destroyObject



143
144
145
# File 'lib/mongo_mapper/plugins/querying.rb', line 143

def destroy
  delete
end

#save(options = {}) ⇒ Object



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

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

#save!(options = {}) ⇒ Object



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

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