/artists: sort autocomplete by post count.

* Add search[order]=post_count param to /artists.
* Make autocomplete do a prefix match ordered by post count, so that it
  works the same way that tag autocomplete does elsewhere.
This commit is contained in:
evazion
2017-04-07 17:20:57 -05:00
parent fbba167f0c
commit 6b462c865e
4 changed files with 9 additions and 6 deletions

View File

@@ -38,7 +38,7 @@ class ArtistsController < ApplicationController
def index
search_params = params[:search].present? ? params[:search] : params
@artists = Artist.includes(:urls).search(search_params).order("id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
@artists = Artist.includes(:urls).search(search_params).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
respond_with(@artists) do |format|
format.xml do
render :xml => @artists.to_xml(:include => [:urls], :root => "artists")