Rail plugin acts_as_taggable_on :through
Posted
by Craig
on Stack Overflow
See other posts from Stack Overflow
or by Craig
Published on 2010-04-24T20:45:19Z
Indexed on
2010/04/25
3:53 UTC
Read the original article
Hit count: 353
I have two models:
class Employee < ActiveRecord::Base
has_many :projects
end
class Project < ActiveRecord::Base
acts_as_taggable_on :skills, :roles
end
I would like to find Employees using the tags associated with their projects. The geokit-rails plugin supports a similar concept, using its ':through' relationship.
Ideally, I would be able to:
- specify which tags (i.e. skills, roles) would be included in the conditions
- order the employees by the total number of projects with matching tags
- be able to access the matching-tag count for each employee for the purposes of building a tag cloud
Any thoughts would be appreciated.
© Stack Overflow or respective owner