aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/autocomplete_calendars_controller.rb
blob: 533b5503a7e7cb5fb8ec568ee32d716dfc762683 (plain)
1
2
3
4
5
6
7
8
class AutocompleteCalendarsController < ApplicationController
  respond_to :json, :only => [:autocomplete]

  def autocomplete
    scope = Calendar.where('organisation_id = ? OR shared = true', current_organisation.id)
    @calendars = scope.search(params[:q]).result.paginate(page: params[:page])
  end
end