Skip to content

Instantly share code, notes, and snippets.

@wagenet
Created April 28, 2009 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wagenet/102891 to your computer and use it in GitHub Desktop.
Save wagenet/102891 to your computer and use it in GitHub Desktop.
require 'proxy_block'
module WithoutTimestamps
def self.included(base)
base.send :extend, ClassMethods
base.send :include, InstanceMethods
class << base; proxy_block :without_timestamps; end
base.send :proxy_block, :without_timestamps
end
module ClassMethods
def without_timestamps
original = self.record_timestamps
self.record_timestamps = false
yield
ensure
self.record_timestamps = original
end
end
module InstanceMethods
def without_timestamps(&block)
self.class.without_timestamps(&block)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment