optimize select
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user