RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: LambdaRed
I'm sure you found you solution by now, but if anyone else is looking around for this:
has_many :taggings, :as => :taggable, :dependent => :destroy has_many :tags, :through => :taggings
And since this is polymorphic these two lines would go into whatever model you wanted to be taggable.
has_many :taggings, :dependent => :destroy has_many :taggables, :through => :taggings
belongs_to :taggable, polymorphic: true belongs_to :tag
I'm sure you found you solution by now, but if anyone else is looking around for this:
And since this is polymorphic these two lines would go into whatever model you wanted to be taggable.