I have the following model setup – a User is interested in projects in many project
Categories. Each Project has many categories. Like so:
class User
has_many :projects
has_and_belongs_to_many :project_categories
class Project
belongs_to :user
has_and_belongs_to_many :project_categories
class ProjectCategory
has_and_belongs_to_many :projects
has_and_belongs_to_many :users
Now, I’d like to do a find for projects with any of the catogories
that a certain user are interested in, i.e. if a user is interested in
project categories A,B,C then I’d like to find projects which are part
of one or more of those project categories.
Anyone?
Thanks for the help! Being a much too eager noob at the moment I haven’t gone through all possible AR solutions, but it would be interesting if something like this brakes the AR abstractions as Pierre said. I went with a modified version of Randy’s suggestion: