RailsCasts Pro episodes are now free!

Learn more or hide this

Solomon S.'s Profile

GitHub User: slm4996

Comments by Solomon S.

Avatar

Here is the solution for those who may want it:

ruby
def self.tagged_with(name) #name is an array of 1 or more tag names
    all(:conditions => {:tags => {:name => name}},
      :joins      => :taggings,
      :joins      => :tags,
      :group      => 'articles.id',
      :having     => ['COUNT(*) >= ?', name.length]
    )
end
Avatar

Ever figure this one out TopperH? I've been struggling with the same problem.