Module: ActiveRecord::Timestamps

Defined in:
lib/acts_as_formatted/timestamps.rb

Instance Method Summary collapse

Instance Method Details

#without_timestamps(&block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/acts_as_formatted/timestamps.rb', line 2

def without_timestamps(&block)
  rec_ts = ActiveRecord::Base.record_timestamps
  applied_to = self.is_a?(Class) ? self : self.class
  applied_to.record_timestamps = false
  begin
    yield
  ensure
    applied_to.record_timestamps = rec_ts
  end
end