From f299244099136607fb8da50f39894efbfdfe3a20 Mon Sep 17 00:00:00 2001 From: Larissa Reis Date: Mon, 18 Jul 2016 13:28:57 -0300 Subject: [PATCH] Only shows distinct followers in profile.followers --- app/models/profile.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index 6fb2a5e..ada6a69 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -250,7 +250,7 @@ class Profile < ApplicationRecord has_many :email_templates, :foreign_key => :owner_id has_many :profile_followers - has_many :followers, :class_name => 'Person', :through => :profile_followers, :source => :person + has_many :followers, -> { uniq }, :class_name => 'Person', :through => :profile_followers, :source => :person # Although this should be a has_one relation, there are no non-silly names for # a foreign key on article to reference the template to which it is -- libgit2 0.21.2