Module: FilterProjects

Extended by:
ActiveSupport::Concern
Included in:
Dashboard::ProjectsController, Explore::ProjectsController, GroupsController
Defined in:
app/controllers/concerns/filter_projects.rb

Overview

FilterProjects

Controller concern to handle projects filtering

  • by name

  • by archived state

Instance Method Summary collapse

Instance Method Details

#filter_projects(projects) ⇒ Object


10
11
12
13
14
15
16
# File 'app/controllers/concerns/filter_projects.rb', line 10

def filter_projects(projects)
  projects = projects.search(params[:filter_projects]) if params[:filter_projects].present?
  projects = projects.non_archived if params[:archived].blank?
  projects = projects.personal(current_user) if params[:personal].present? && current_user

  projects
end