Module: Mongoid::Timestamps::InstanceMethods

Defined in:
lib/mongoid/timestamps.rb

Instance Method Summary collapse

Instance Method Details

#set_created_atObject

Update the created_at field on the Document to the current time. This is only called on create.



15
16
17
# File 'lib/mongoid/timestamps.rb', line 15

def set_created_at
  self.created_at = Time.now.utc if !created_at
end

#set_updated_atObject

Update the updated_at field on the Document to the current time. This is only called on create and on save.



21
22
23
# File 'lib/mongoid/timestamps.rb', line 21

def set_updated_at
  self.updated_at = Time.now.utc
end