Created
October 25, 2012 20:05
-
-
Save cwsaylor/3955091 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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