Sha256: 60d6a40adf757948ecf27592c34d2048bb6227f763946569c7b0dd72ee5d3585

Contents?: true

Size: 718 Bytes

Versions: 14

Compression:

Stored size: 718 Bytes

Contents

# -*- encoding : utf-8 -*-
module AbAdmin
  module Concerns
    module Silencer

      def no_timestamps(&block)
        original_setting = ActiveRecord::Base.record_timestamps
        ActiveRecord::Base.record_timestamps = false
        begin
          yield
        ensure
          ActiveRecord::Base.record_timestamps = original_setting
        end
      end

      def no_versions(&block)
        original_setting = PaperTrail.enabled?
        PaperTrail.enabled = false
        begin
          yield
        ensure
          PaperTrail.enabled = original_setting
        end
      end

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

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ab_admin-0.3.6 lib/ab_admin/concerns/silencer.rb
ab_admin-0.3.5 lib/ab_admin/concerns/silencer.rb
ab_admin-0.3.4 lib/ab_admin/concerns/silencer.rb
ab_admin-0.3.3 lib/ab_admin/concerns/silencer.rb
ab_admin-0.3.2 lib/ab_admin/concerns/silencer.rb
ab_admin-0.3.1 lib/ab_admin/concerns/silencer.rb
ab_admin-0.3.0 lib/ab_admin/concerns/silencer.rb
ab_admin-0.2.3 lib/ab_admin/concerns/silencer.rb
ab_admin-0.2.2 lib/ab_admin/concerns/silencer.rb
ab_admin-0.2.1 lib/ab_admin/concerns/silencer.rb
ab_admin-0.2.0 lib/ab_admin/concerns/silencer.rb
ab_admin-0.1.2 lib/ab_admin/concerns/silencer.rb
ab_admin-0.1.1 lib/ab_admin/concerns/silencer.rb
ab_admin-0.1.0 lib/ab_admin/concerns/silencer.rb