Skip to content

Instantly share code, notes, and snippets.

@airblade
Created October 9, 2009 09:26
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 airblade/205881 to your computer and use it in GitHub Desktop.
Save airblade/205881 to your computer and use it in GitHub Desktop.
# PaperTrail's version class (existing code omitted for clarity).
class Version < ActiveRecord::Base
before_update :before_update_hook
after_update :after_update_hook
def before_update_hook
end
def after_update_hook
end
end
# In a client Rails app, re-open version class to implement hooks.
class Version < ActiveRecord::Base
def before_update_hook
self.phase_of_moon = MoonWebService.get_phase
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment