Skip to content

Instantly share code, notes, and snippets.

@fayimora
Created February 20, 2012 19:13
Show Gist options
  • Save fayimora/1870812 to your computer and use it in GitHub Desktop.
Save fayimora/1870812 to your computer and use it in GitHub Desktop.
class Post < ActiveRecord::Base
has_many :tags, as: :taggable, through: :tag_joins
end
class Projects < ActiveRecord::Base
has_many :tags, as: :taggable, through: :tag_joins
end
class Tag < ActiveRecord::Base
has_many :taggables, through: :tag_joins
end
class TagJoin < ActiveRecord::Base
belongs_to :tag
belongs_to :parent, polymorphic: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment