blob: cb230242e6e74848168345510584771e85d61362 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
class Projects::StarrersController < Projects::ApplicationController
include SortingHelper
# Authorize
before_action :require_non_empty_project
# rubocop: disable CodeReuse/ActiveRecord
def index
@sort = params[:sort].presence || sort_value_name
params[:has_starred] = @project
@starrers = UsersFinder.new(current_user, params).execute
@starrers = @starrers.joins(:users_star_projects)
.select('"users".*, "users_star_projects"."created_at" as "starred_since"')
.where(users_star_projects: { project_id: @project.project_id })
@starrers = @starrers.sort_by_attribute(@sort)
end
# rubocop: enable CodeReuse/ActiveRecord
end
|