Given the class definitions:
class Member < ActiveRecord::Base has_many :assignments, :dependent => :destroy has_many :projects, :through => :assignments, :uniq => true # ... end
class Project < ActiveRecord::Base has_many :assignments, :dependent => :destroy has_many :members, :through => :assignments, :uniq => true # ... end
class Assignment < ActiveRecord::Base belongs_to :member belongs_to :project # ... end
I'm trying to construct an EZ_where query that will find members that have a given project assignment. Something along the lines of:
members = Member.find(:all, :include => :assignments, :conditions => ["assignments.project_id=?", project])
I'm building the query step by step using statements like:
cond = Caboose::EZ::Condition.new :members do any {first =~ text_search; last =~ text_search} end
to create interesting filters. The last piece of the puzzle is to filter by project.
Any hints?
TIA