Module: Mongoid::History

Defined in:
lib/mongoid/history.rb,
lib/mongoid/history/tracker.rb,
lib/mongoid/history/trackable.rb

Defined Under Namespace

Modules: Trackable, Tracker

Constant Summary collapse

GLOBAL_TRACK_HISTORY_FLAG =
"mongoid_history_trackable_enabled"

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

Returns:

  • (Boolean)


21
22
23
# File 'lib/mongoid/history.rb', line 21

def self.enabled?
  Thread.current[GLOBAL_TRACK_HISTORY_FLAG] != false
end

.tracker_classObject



10
11
12
# File 'lib/mongoid/history.rb', line 10

def self.tracker_class
  @tracker_class ||= tracker_class_name.to_s.classify.constantize
end