Method: Mongoid::Timestamps::Timeless::ClassMethods#timeless

Defined in:
lib/mongoid/timestamps/timeless.rb

#timelessClass

Begin an execution that should skip timestamping.

Examples:

Create a document but don’t timestamp.

Person.timeless.create(:title => "Sir")

Returns:

  • (Class)

    The class this was called on.

Since:

  • 2.3.0



59
60
61
62
63
64
65
# File 'lib/mongoid/timestamps/timeless.rb', line 59

def timeless
  counter = 0
  counter += 1 if self < Mongoid::Timestamps::Created
  counter += 1 if self < Mongoid::Timestamps::Updated
  Timeless[name] = counter
  self
end