Module: MarkMapper::Plugins::Timestamps

Extended by:
ActiveSupport::Concern
Included in:
Document, EmbeddedDocument
Defined in:
lib/mark_mapper/plugins/timestamps.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#update_timestampsObject


20
21
22
23
24
25
26
# File 'lib/mark_mapper/plugins/timestamps.rb', line 20

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