Skip to content

Instantly share code, notes, and snippets.

@rich
Created May 12, 2009 18:49
Show Gist options
  • Select an option

  • Save rich/110657 to your computer and use it in GitHub Desktop.

Select an option

Save rich/110657 to your computer and use it in GitHub Desktop.
class Post < ActiveRecord::Base
acts_as_revisable
has_many :links, :before_add => :revise!
after_revise :revise_links!
private
def revise_links!
self.links.each(&:revise!)
end
end
class PostRevision < ActiveRecord::Base
acts_as_revision
has_many :links, :class_name => "LinkRevision", :foreign_key => "post_id"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment