From eef2d9d599b4f5bf059b7971f6f9c13c46577df8 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 1 Jul 2025 09:16:50 +0300 Subject: [PATCH] use union all --- app/controllers/templates_dashboard_controller.rb | 2 +- lib/abilities/template_conditions.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/templates_dashboard_controller.rb b/app/controllers/templates_dashboard_controller.rb index 26592a10..218c89e7 100644 --- a/app/controllers/templates_dashboard_controller.rb +++ b/app/controllers/templates_dashboard_controller.rb @@ -57,7 +57,7 @@ class TemplatesDashboardController < ApplicationController rel = Template.where( Template.arel_table[:id].in( rel.where(folder_id: current_account.default_template_folder.id).select(:id).arel - .union(shared_template_ids.arel) + .union(:all, shared_template_ids.arel) ) ) else diff --git a/lib/abilities/template_conditions.rb b/lib/abilities/template_conditions.rb index ac50f3aa..dede24ce 100644 --- a/lib/abilities/template_conditions.rb +++ b/lib/abilities/template_conditions.rb @@ -13,7 +13,7 @@ module Abilities TemplateSharing.where({ ability:, account_id: [user.account_id, TemplateSharing::ALL_ID] }.compact) .select(:template_id) - Template.where(Template.arel_table[:id].in(templates.select(:id).arel.union(shared_ids.arel))) + Template.where(Template.arel_table[:id].in(templates.select(:id).arel.union(:all, shared_ids.arel))) end def entity(template, user:, ability: nil)