2012-03-06 15:53:04 +00:00
|
|
|
class SearchController < ApplicationController
|
2014-11-17 21:17:03 +00:00
|
|
|
include PaginateHelper
|
|
|
|
|
2015-03-04 23:19:19 +00:00
|
|
|
before_action :authenticate_user! unless APP_CONFIG['anonymous_access']
|
2012-03-06 15:53:04 +00:00
|
|
|
# load_and_authorize_resource
|
|
|
|
|
|
|
|
def index
|
2014-11-17 21:17:03 +00:00
|
|
|
@type = Search::TYPES.find{ |t| t == params[:type] } || Search::TYPES.first
|
|
|
|
@query = params[:query]
|
|
|
|
@search = Search.new(@query, current_ability, paginate_params)
|
|
|
|
@collection = @search.send(@type)
|
2012-03-06 15:53:04 +00:00
|
|
|
end
|
|
|
|
end
|