Skip to content

Instantly share code, notes, and snippets.

@axgle
Created October 16, 2009 06:40
Show Gist options
  • Save axgle/211609 to your computer and use it in GitHub Desktop.
Save axgle/211609 to your computer and use it in GitHub Desktop.
class Entity < ActiveRecord::Base
serialize :body
belongs_to :resource,:polymorphic => true
end
class Report < ActiveRecord::Base
has_one :entity,:as=>:resource
end
class Post < ActiveRecord::Base
has_many :entities, :as=>:resource
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment