Module: Mongoid::Timestamps

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid_rails_fixtures/mongoid_ext/timestamps_ext.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.



17
18
19
# File 'lib/mongoid_rails_fixtures/mongoid_ext/timestamps_ext.rb', line 17

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.



23
24
25
# File 'lib/mongoid_rails_fixtures/mongoid_ext/timestamps_ext.rb', line 23

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