Rename User.by_authors to with_ids
The "by_authors" scope was the last remaining name from the removed family of `by_author` scopes. It no longer reflects its purpose: it simply loads users by IDs.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user