summaryrefslogtreecommitdiff
path: root/app/controllers/search_controller.rb
blob: 71e2d92b2b2c9eb6fc75d6dbb22cad6154d37a5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class SearchController < ApplicationController
  def show
    query = params[:search]

    @projects = []
    @merge_requests = []
    @issues = []

    if query.present?
      @projects = current_user.projects.search(query).limit(10)
      @merge_requests = MergeRequest.where(project_id: current_user.project_ids).search(query).limit(10)
      @issues = Issue.where(project_id: current_user.project_ids).search(query).limit(10)
    end
  end
end