rosa-build/app/controllers/search_controller.rb

13 lines
395 B
Ruby
Raw Normal View History

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']
def index
2014-11-17 21:17:03 +00:00
@type = Search::TYPES.find{ |t| t == params[:type] } || Search::TYPES.first
@query = params[:query]
2015-04-06 23:56:06 +01:00
@search = Search.new(@query, current_user, paginate_params)
2014-11-17 21:17:03 +00:00
@collection = @search.send(@type)
end
end