0
0
Fork 0

Add limit to search results

This commit is contained in:
Eugen Rochko 2016-11-12 14:49:28 +01:00
parent 09218d4c01
commit afded319d2
3 changed files with 12 additions and 14 deletions

View file

@ -92,7 +92,8 @@ class Api::V1::AccountsController < ApiController
end
def search
@accounts = SearchService.new.call(params[:q], params[:resolve] == 'true')
limit = params[:limit] ? [DEFAULT_ACCOUNTS_LIMIT, params[:limit].to_i].min : DEFAULT_ACCOUNTS_LIMIT
@accounts = SearchService.new.call(params[:q], limit, params[:resolve] == 'true')
render action: :index
end