app/controllers/katello/api/v2/debs_controller.rb in katello-4.13.1 vs app/controllers/katello/api/v2/debs_controller.rb in katello-4.14.0.rc1
- old
+ new
@@ -12,12 +12,13 @@
def auto_complete(search)
page_size = Katello::Concerns::FilteredAutoCompleteSearch::PAGE_SIZE
debs = Deb.in_repositories(@repositories)
col = ''
- if search == 'name'
+ case search
+ when 'name'
col = "#{Deb.table_name}.name"
- elsif search == 'arch'
+ when 'arch'
col = "#{Deb.table_name}.architecture"
end
debs = debs.where("#{col} ILIKE ?", "#{params[:term]}%").select(col).group(col).order(col).limit(page_size)
render :json => debs.pluck(col)
end