Module: Mongoid::CollectionSnapshot::ClassMethods

Defined in:
lib/mongoid_collection_snapshot.rb

Instance Method Summary collapse

Instance Method Details

#document(name = nil, &block) ⇒ Object



62
63
64
65
# File 'lib/mongoid_collection_snapshot.rb', line 62

def document(name = nil, &block)
  self.document_blocks ||= {}
  self.document_blocks[name || DEFAULT_COLLECTION_KEY_NAME] = block
end

#latestObject



58
59
60
# File 'lib/mongoid_collection_snapshot.rb', line 58

def latest
  order_by([[:created_at, :desc]]).first
end