Module: AbAdmin::Concerns::Silencer

Defined in:
lib/ab_admin/concerns/silencer.rb

Instance Method Summary collapse

Instance Method Details

#full_silence(&block) ⇒ Object


24
25
26
27
28
# File 'lib/ab_admin/concerns/silencer.rb', line 24

def full_silence(&block)
  no_timestamps do
    no_versions(&block)
  end
end

#no_timestampsObject


4
5
6
7
8
9
10
11
12
# File 'lib/ab_admin/concerns/silencer.rb', line 4

def no_timestamps
  original_setting = ActiveRecord::Base.record_timestamps
  ActiveRecord::Base.record_timestamps = false
  begin
    yield
  ensure
    ActiveRecord::Base.record_timestamps = original_setting
  end
end

#no_versionsObject


14
15
16
17
18
19
20
21
22
# File 'lib/ab_admin/concerns/silencer.rb', line 14

def no_versions
  original_setting = Track.tracking_enabled
  Track.tracking_enabled = false
  begin
    yield
  ensure
    Track.tracking_enabled = original_setting
  end
end