Skip to content

Instantly share code, notes, and snippets.

@sporkd
Created June 20, 2009 03:07
Show Gist options
  • Save sporkd/133023 to your computer and use it in GitHub Desktop.
Save sporkd/133023 to your computer and use it in GitHub Desktop.
has_many :tags_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => "taggings.association = 'tags'", :dependent => :destroy
has_many :tags, :class_name => 'Tag', :through => :tags_taggings, :source => :tag
has_many :likes_taggings, :as => :taggable, :class_name => 'Tagging', :conditions => "taggings.association = 'likes'", :dependent => :destroy
has_many :likes, :class_name => 'Tag', :through => :likes_taggings, :source => :tag
define_index do
indexes tags(:name), :as => :tags
indexes likes(:name), :as => :likes
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment