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
Class Method Summary collapse
Instance Method Summary collapse
-
#clear_timeless_option ⇒ true
Clears out the timeless option.
-
#timeless ⇒ Document
Begin an execution that should skip timestamping.
- #timeless? ⇒ Boolean
Class Method Details
.timeless_table ⇒ Object
49 50 51 |
# File 'lib/mongoid/timestamps/timeless.rb', line 49 def timeless_table Thread.current['[mongoid]:timeless'] ||= Hash.new end |
Instance Method Details
#clear_timeless_option ⇒ true
Clears out the timeless option.
20 21 22 23 24 25 26 27 |
# File 'lib/mongoid/timestamps/timeless.rb', line 20 def clear_timeless_option if self.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.
37 38 39 40 |
# File 'lib/mongoid/timestamps/timeless.rb', line 37 def timeless self.class.timeless self end |
#timeless? ⇒ Boolean
42 43 44 |
# File 'lib/mongoid/timestamps/timeless.rb', line 42 def timeless? self.class.timeless? end |