From c979cc741131e3d756b0d15b1f1b428e6914b132 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Sun, 8 Apr 2018 14:53:14 +0200 Subject: [PATCH] Fix uniq deprecation warning DEPRECATION WARNING: uniq is deprecated and will be removed from Rails 5.1 (use distinct instead) (called from block in at /home/travis/build/consul/consul/app/models/user.rb:67) --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index fb38b9753..02157212e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -64,7 +64,7 @@ class User < ActiveRecord::Base scope :active, -> { where(erased_at: nil) } scope :erased, -> { where.not(erased_at: nil) } scope :public_for_api, -> { all } - scope :by_comments, ->(query, topics_ids) { joins(:comments).where(query, topics_ids).uniq } + scope :by_comments, ->(query, topics_ids) { joins(:comments).where(query, topics_ids).distinct } scope :by_authors, ->(author_ids) { where("users.id IN (?)", author_ids) } scope :by_username_email_or_document_number, ->(search_string) do string = "%#{search_string}%"