Merge pull request #2287 from italomatos/refactor/use-ids-method-instead-of-pluck

Refactor: Replace pluck(:id) with ids method
This commit is contained in:
Jorge Manrubia
2026-01-05 16:03:41 +01:00
committed by GitHub
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ class BoardsController < ApplicationController
end
def edit
selected_user_ids = @board.users.pluck :id
selected_user_ids = @board.users.ids
@selected_users, @unselected_users = \
@board.account.users.active.alphabetically.includes(:identity).partition { |user| selected_user_ids.include? user.id }
end
+3 -4
View File
@@ -21,7 +21,7 @@ module Board::Storage
end
def card_ids
@card_ids ||= cards.pluck(:id)
@card_ids ||= cards.ids
end
def card_image_bytes
@@ -36,7 +36,7 @@ module Board::Storage
def comment_embed_bytes
card_ids.each_slice(BATCH_SIZE).sum do |batch|
sum_embed_bytes_for "Comment", Comment.where(card_id: batch).pluck(:id)
sum_embed_bytes_for "Comment", Comment.where(card_id: batch).ids
end
end
@@ -46,8 +46,7 @@ module Board::Storage
def sum_embed_bytes_for(record_type, record_ids)
rich_text_ids = ActionText::RichText \
.where(record_type: record_type, record_id: record_ids)
.pluck(:id)
.where(record_type: record_type, record_id: record_ids).ids
sum_blob_bytes_in_batches \
ActiveStorage::Attachment.where(record_type: "ActionText::RichText", name: "embeds"),
+1 -1
View File
@@ -13,6 +13,6 @@ module User::Accessor
private
def grant_access_to_boards
Access.insert_all account.boards.all_access.pluck(:id).collect { |board_id| { id: ActiveRecord::Type::Uuid.generate, board_id: board_id, user_id: id, account_id: account.id } }
Access.insert_all account.boards.all_access.ids.collect { |board_id| { id: ActiveRecord::Type::Uuid.generate, board_id: board_id, user_id: id, account_id: account.id } }
end
end