adjust folder query

This commit is contained in:
Pete Matsyburka
2025-07-01 09:02:40 +03:00
parent 8b775103c7
commit 8ad70b7e74
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -95,9 +95,9 @@ module Api
templates = templates.where(slug: params[:slug]) if params[:slug].present?
if params[:folder].present?
folder = TemplateFolder.accessible_by(current_ability).find_by(name: params[:folder])
folder_ids = TemplateFolder.accessible_by(current_ability).where(name: params[:folder]).pluck(:id)
templates = folder ? templates.where(folder:) : templates.none
templates = templates.where(folder_id: folder_ids)
end
templates