artists: move artist finding code from controller to model.

This commit is contained in:
evazion
2017-11-14 20:22:47 -06:00
parent 56bf518e6d
commit 58018aeb2b
2 changed files with 13 additions and 8 deletions

View File

@@ -101,14 +101,7 @@ class ArtistsController < ApplicationController
end
def finder
begin
@artists = Artist.url_matches(params[:url]).order("id desc").limit(10)
if @artists.empty? && params[:referer_url].present? && params[:referer_url] != params[:url]
@artists = Artist.url_matches(params[:referer_url]).order("id desc").limit(20)
end
rescue PixivApiClient::Error => e
@artists = []
end
@artists = Artist.find_artists(params[:url], params[:referer_url])
respond_with(@artists) do |format|
format.xml do