From 19ffa2d9345518fc5bfff6a9ae6678bf112a26b7 Mon Sep 17 00:00:00 2001 From: Marcelo JĂșnior Date: Fri, 22 Jul 2016 17:46:29 +0000 Subject: [PATCH] fix sql error when using the pg_search plugin --- app/controllers/my_profile/cms_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 79e0c77..478817c 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -255,7 +255,8 @@ class CmsController < MyProfileController end def search_communities_to_publish - render :text => find_by_contents(:profiles, environment, user.memberships, params['q'], {:page => 1}, {:fields => ['name']})[:results].map {|community| {:id => community.id, :name => community.name} }.to_json + scope = user.memberships.distinct(false).group([:id,:name]) + render :text => find_by_contents(:profiles, environment, scope, params['q'], {:page => 1}, {:fields => ['name']})[:results].map {|community| {:id => community.id, :name => community.name} }.to_json end def publish -- libgit2 0.21.2