rosa-build/app/controllers/api/v1/search_controller.rb

13 lines
358 B
Ruby
Raw Normal View History

2012-11-21 12:09:01 +00:00
class Api::V1::SearchController < Api::V1::BaseController
def index
authorize :search
search = Search.new(params[:query], current_user, paginate_params)
2014-11-24 21:01:39 +00:00
types = Search::TYPES.find{ |t| t == params[:type] } || Search::TYPES
@results = {}
[types].flatten.each do |type|
@results[type] = search.send(type)
end
2012-11-21 12:09:01 +00:00
end
end