– MODELS –
has_many :skills, :through => :prof
belongs_to :user # user_id
belongs_to :skill # skill_id
– CONTROLLER –
searched_skills = [2,18,6] # comes from params[:search_skills]
I need to find @users who having ALL of searched skills.
@users = User.paginate :conditions => [“profs.skill_id IN (?)”,
searched_skills], :include => :profs, :page => page
does not help (since it use OR). It returns all users who having at
least one of searched_skills.
I need this thing in one query that return @users paginated array
im late night 4 hours work, plz dont judge me