module Mongoid::Timestamps::Timeless
This module adds behaviour for turning off timestamping in single or multiple calls.
Public Class Methods
timeless_table()
click to toggle source
# File lib/mongoid/timestamps/timeless.rb, line 46 def timeless_table Thread.current['[mongoid]:timeless'] ||= 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.
@since 3.1.4
# 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.
@since 2.3.0
# File lib/mongoid/timestamps/timeless.rb, line 35 def timeless self.class.timeless self end
timeless?()
click to toggle source
# File lib/mongoid/timestamps/timeless.rb, line 40 def timeless? self.class.timeless? end