From 57e596c67e1ebd0330381600666080b7c56e578c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sede=C3=B1o?= Date: Tue, 12 Dec 2017 22:08:48 +0100 Subject: [PATCH] Use distinct instead of uniq because deprectation. --- app/models/user.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 9a44a6a6..d062529a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -45,8 +45,8 @@ class User < ApplicationRecord attr_accessor :login has_many :event_users, dependent: :destroy - has_many :events, -> { uniq }, through: :event_users - has_many :presented_events, -> { joins(:event_users).where(event_users: {event_role: 'speaker'}).uniq }, through: :event_users, source: :event + has_many :events, -> { distinct }, through: :event_users + has_many :presented_events, -> { joins(:event_users).where(event_users: {event_role: 'speaker'}).distinct }, through: :event_users, source: :event has_many :registrations, dependent: :destroy do def for_conference conference where(conference: conference).first