Module: MongoMapper::Plugins::Timestamps::InstanceMethods

Defined in:
lib/mongo_mapper/plugins/timestamps.rb

Instance Method Summary collapse

Instance Method Details

#update_timestampsObject



13
14
15
16
17
# File 'lib/mongo_mapper/plugins/timestamps.rb', line 13

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