Add and apply Rails/SelectMap rule
This rule was introduced in rubocop-rails 2.21.0. Using `pluck` is easier to read.
This commit is contained in:
@@ -7,7 +7,7 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
|
||||
@officers = ::Poll::Officer
|
||||
.includes(:user)
|
||||
.order("users.username")
|
||||
.where(id: @poll.officer_assignments.select(:officer_id).distinct.map(&:officer_id))
|
||||
.where(id: @poll.officer_assignments.distinct.pluck(:officer_id))
|
||||
.page(params[:page])
|
||||
.per(50)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user