Skip to content

Instantly share code, notes, and snippets.

@cwsaylor
Created October 25, 2012 20:05
Show Gist options
  • Save cwsaylor/3955091 to your computer and use it in GitHub Desktop.
Save cwsaylor/3955091 to your computer and use it in GitHub Desktop.
# To audit Foo model, create a model called FooLog and include this concern
module Auditable
extend ActiveSupport::Concern
included do
after_save :audit
end
module InstanceMethods
def audit
"#{self.class.name}Log".constantize.create self.serializable_hash
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment