Module: Mongoid::History
- Defined in:
- lib/mongoid/history.rb,
lib/mongoid/history/mongoid.rb,
lib/mongoid/history/tracker.rb,
lib/mongoid/history/version.rb,
lib/mongoid/history/trackable.rb
Defined Under Namespace
Modules: Trackable, Tracker
Constant Summary
collapse
- GLOBAL_TRACK_HISTORY_FLAG =
"mongoid_history_trackable_enabled"
- VERSION =
'0.4.2'
Class Method Summary
collapse
Class Method Details
.disable(&_block) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/mongoid/history.rb', line 14
def self.disable(&_block)
Thread.current[GLOBAL_TRACK_HISTORY_FLAG] = false
yield
ensure
Thread.current[GLOBAL_TRACK_HISTORY_FLAG] = true
end
|
.enabled? ⇒ Boolean
21
22
23
|
# File 'lib/mongoid/history.rb', line 21
def self.enabled?
Thread.current[GLOBAL_TRACK_HISTORY_FLAG] != false
end
|
.mongoid3? ⇒ Boolean
3
4
5
|
# File 'lib/mongoid/history/mongoid.rb', line 3
def self.mongoid3?
::Mongoid.const_defined? :Observer
end
|
.tracker_class ⇒ Object
10
11
12
|
# File 'lib/mongoid/history.rb', line 10
def self.tracker_class
@tracker_class ||= tracker_class_name.to_s.classify.constantize
end
|