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:
taitus
2025-11-14 11:46:11 +01:00
parent a9129158c1
commit 4e455578d1
2 changed files with 3 additions and 3 deletions

View File

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

View File

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