Select distinct people in contacts index

This commit is contained in:
Raphael Sofaer
2011-08-11 11:56:23 -07:00
parent a2043671ce
commit 7021cd79c8
2 changed files with 9 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ class ContactsController < ApplicationController
format.mobile { @contacts = sort_and_paginate_profiles(@contacts) }
format.json {
@people = Person.joins(:contacts => :aspect_memberships).
select('DISTINCT people.*').
where(:contacts => { :user_id => current_user.id },
:aspect_memberships => { :aspect_id => params[:aspect_ids] })