diff --git a/app/models/community.rb b/app/models/community.rb index 48a6029d3..1852aa4f0 100644 --- a/app/models/community.rb +++ b/app/models/community.rb @@ -49,8 +49,8 @@ class Community < ApplicationRecord end def users_who_topics_author - author_ids = topics.pluck(:author_id) - User.by_authors(author_ids) + ids = topics.pluck(:author_id) + User.with_ids(ids) end def author_from_community diff --git a/app/models/user.rb b/app/models/user.rb index 7af90cdbe..f97e811c7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -111,7 +111,7 @@ class User < ApplicationRecord scope :erased, -> { where.not(erased_at: nil) } scope :active, -> { excluding(erased) } scope :public_for_api, -> { all } - scope :by_authors, ->(author_ids) { where(id: author_ids) } + scope :with_ids, ->(ids) { where(id: ids) } scope :by_comments, ->(commentables) do joins(:comments).where("comments.commentable": commentables).distinct end