Module: MongoMapper::Plugins::Timestamps

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#update_timestampsObject



15
16
17
18
19
# File 'lib/mongo_mapper/plugins/timestamps.rb', line 15

def update_timestamps
  now = Time.now.utc
  self[:created_at] = now if !persisted? && !created_at?
  self[:updated_at] = now
end