Module: Mongoid::Timestamps::Timeless
- Extended by:
- ActiveSupport::Concern, Forwardable
- Defined in:
- lib/mongoid/timestamps/timeless.rb
Overview
This module adds behavior for turning off timestamping in single or multiple calls.
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- TIMELESS_TABLE_KEY =
The key to use to store the timeless table
'[mongoid]:timeless'
Class Method Summary collapse
-
.timeless_table ⇒ Hash
private
Returns the in-memory thread cache of classes for which to skip timestamping.
Instance Method Summary collapse
-
#clear_timeless_option ⇒ true
Clears out the timeless option.
-
#timeless ⇒ Document
Begin an execution that should skip timestamping.
-
#timeless? ⇒ true | false
Returns whether the document should skip timestamping.
Class Method Details
.timeless_table ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the in-memory thread cache of classes for which to skip timestamping.
56 57 58 |
# File 'lib/mongoid/timestamps/timeless.rb', line 56 def timeless_table Threaded.get(TIMELESS_TABLE_KEY) { {} } end |
Instance Method Details
#clear_timeless_option ⇒ true
Clears out the timeless option.
16 17 18 19 20 21 22 23 |
# File 'lib/mongoid/timestamps/timeless.rb', line 16 def clear_timeless_option if persisted? self.class.clear_timeless_option_on_update else self.class.clear_timeless_option end true end |
#timeless ⇒ Document
Begin an execution that should skip timestamping.
31 32 33 34 |
# File 'lib/mongoid/timestamps/timeless.rb', line 31 def timeless self.class.timeless self end |
#timeless? ⇒ true | false
Returns whether the document should skip timestamping.
40 41 42 |
# File 'lib/mongoid/timestamps/timeless.rb', line 40 def timeless? self.class.timeless? end |