24 lines
745 B
Ruby
24 lines
745 B
Ruby
class ApiSearchController < ApiController
|
|
|
|
# have to be signed in currently to see this screen
|
|
before_filter :api_signed_in_user
|
|
|
|
respond_to :json
|
|
|
|
def index
|
|
if 1 == params[Search::PARAM_MUSICIAN].to_i
|
|
query = params.clone
|
|
query[:remote_ip] = request.remote_ip
|
|
@search = Search.musician_search(query, current_user)
|
|
respond_with @search, responder: ApiResponder, :status => 200
|
|
elsif 1 == params[Search::PARAM_BAND].to_i
|
|
query = params.clone
|
|
query[:remote_ip] = request.remote_ip
|
|
@search = Search.band_search(query, current_user)
|
|
respond_with @search, responder: ApiResponder, :status => 200
|
|
else
|
|
@search = Search.search(params[:query], current_user.id)
|
|
end
|
|
end
|
|
end
|