module Mongoid::Timestamps::Timeless
This module adds behavior for turning off timestamping in single or multiple calls.
Constants
- TIMELESS_TABLE_KEY
The key to use to store the timeless table
Public Class Methods
timeless_table()
click to toggle source
Returns the in-memory thread cache of classes for which to skip timestamping.
@return [ Hash ] The timeless table.
@api private
# File lib/mongoid/timestamps/timeless.rb, line 58 def timeless_table Threaded.get(TIMELESS_TABLE_KEY) { Hash.new } end
Public Instance Methods
clear_timeless_option()
click to toggle source
Clears out the timeless option.
@example Clear the timeless option.
document.clear_timeless_option
@return [ true ] True.
# File lib/mongoid/timestamps/timeless.rb, line 18 def clear_timeless_option if self.persisted? self.class.clear_timeless_option_on_update else self.class.clear_timeless_option end true end
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.
# File lib/mongoid/timestamps/timeless.rb, line 33 def timeless self.class.timeless self end
timeless?()
click to toggle source
Returns whether the document should skip timestamping.
@return [ true | false ] Whether the document should
skip timestamping.
# File lib/mongoid/timestamps/timeless.rb, line 42 def timeless? self.class.timeless? end