Module: Mongoid::Timestamps::Created

Defined in:
lib/workarea/ext/mongoid/timestamps_timeless.rb

Instance Method Summary collapse

Instance Method Details

#set_created_atObject



8
9
10
11
12
13
14
15
16
# File 'lib/workarea/ext/mongoid/timestamps_timeless.rb', line 8

def set_created_at
  if !timeless? && !created_at
    time = Time.current.utc
    self.updated_at = time if is_a?(Updated) && !updated_at_changed?
    self.created_at = time
  end

  clear_timeless_option
end