Use distinct instead of uniq because deprectation.

This commit is contained in:
David Sedeño 2017-12-12 22:08:48 +01:00 committed by Stella Rouzi
parent 83053f4626
commit 57e596c67e

View file

@ -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