optimize select

This commit is contained in:
Pete Matsyburka
2026-06-28 10:52:54 +03:00
parent e54d76f0e2
commit 3cb37748e9
11 changed files with 60 additions and 18 deletions
+5
View File
@@ -107,6 +107,11 @@ class Submission < ApplicationRecord
.and(Submitter.arel_table[:completed_at].eq(nil))).select(1).arel.exists)
}
scope :select_for_list, lambda {
select(:id, :name, :created_by_user_id, :account_id,
:created_at, :archived_at, :expire_at, :template_id, :template_submitters)
}
enum :source, {
invite: 'invite',
bulk: 'bulk',
+2
View File
@@ -81,6 +81,8 @@ class Template < ApplicationRecord
scope :active, -> { where(archived_at: nil) }
scope :archived, -> { where.not(archived_at: nil) }
scope :select_for_list, -> { select(:id, :name, :author_id, :account_id, :created_at, :archived_at, :folder_id) }
def application_key
external_id
end