From 8dbe779237008d74e4d390e33ab74ec163279f57 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Tue, 8 Oct 2024 07:34:15 -0500 Subject: [PATCH] Add ability to search artists in yiffy2 management --- app/controllers/yiff_rest/api_v2/images_controller.rb | 2 +- app/models/api_image.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/yiff_rest/api_v2/images_controller.rb b/app/controllers/yiff_rest/api_v2/images_controller.rb index bba8717..9a2939b 100644 --- a/app/controllers/yiff_rest/api_v2/images_controller.rb +++ b/app/controllers/yiff_rest/api_v2/images_controller.rb @@ -69,7 +69,7 @@ module YiffRest end def search_images_params - permit_search_params(%i[category md5 original_url]) + permit_search_params(%i[category md5 original_url artists]) end def create_params diff --git a/app/models/api_image.rb b/app/models/api_image.rb index 273567e..2ffc211 100644 --- a/app/models/api_image.rb +++ b/app/models/api_image.rb @@ -79,6 +79,7 @@ class APIImage < ApplicationRecord q = super q = q.attribute_matches(:category, params[:category]) q = q.attribute_matches(:original_url, params[:original_url]) + q = q.attribute_matches(:artists, params[:artists]) q.order(created_at: :desc) end end