Module: MongoMapper::Plugins::Micelaneous::InstanceMethods

Defined in:
lib/mongo_mapper_ext/mongo_mapper/plugins/micelaneous.rb

Instance Method Summary collapse

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/mongo_mapper_ext/mongo_mapper/plugins/micelaneous.rb', line 9

def exist?
  self.class.find(id) != nil
end

#upsert!(*args) ⇒ Object



5
6
7
# File 'lib/mongo_mapper_ext/mongo_mapper/plugins/micelaneous.rb', line 5

def upsert! *args
  self.class.upsert!({id: id}, *args)
end