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

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

Instance Method Summary collapse

Instance Method Details

#update_timestampsObject



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

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