debian-mirror-gitlab/lib/gitlab/timeless.rb

18 lines
352 B
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
module Gitlab
module Timeless
def self.timeless(model, &block)
original_record_timestamps = model.record_timestamps
model.record_timestamps = false
if block.arity.abs == 1
block.call(model)
else
block.call
end
2018-03-17 18:26:18 +05:30
2016-08-24 12:49:21 +05:30
ensure
model.record_timestamps = original_record_timestamps
end
end
end