module Mongoid::Timestamps::Timeless

This module adds behaviour for turning off timestamping in single or multiple calls.

Public Instance Methods

timeless() click to toggle source

Begin an execution that should skip timestamping.

@example Save a document but don't timestamp.

person.timeless.save

@return [ Document ] The document this was called on.

@since 2.3.0

# File lib/mongoid/timestamps/timeless.rb, line 17
def timeless
  Threaded.timeless = true
  self
end
timestamping?() click to toggle source

Are we currently timestamping?

@example Should timestamps be applied?

person.timestamping?

@return [ true, false ] If the current thread is timestamping.

@since 2.3.0

# File lib/mongoid/timestamps/timeless.rb, line 30
def timestamping?
  Threaded.timestamping?
end