fix sqlite remove template

This commit is contained in:
Pete Matsyburka
2025-06-30 11:44:55 +03:00
parent 10e4476f4a
commit d0ac4ad222
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ class Submission < ApplicationRecord
belongs_to :account
belongs_to :created_by_user, class_name: 'User', optional: true
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy if SearchEntry.table_exists?
has_many :submitters, dependent: :destroy
has_many :submission_events, dependent: :destroy
+1 -1
View File
@@ -43,7 +43,7 @@ class Submitter < ApplicationRecord
belongs_to :submission
belongs_to :account
has_one :template, through: :submission
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy if SearchEntry.table_exists?
attribute :values, :string, default: -> { {} }
attribute :preferences, :string, default: -> { {} }
+1 -1
View File
@@ -44,7 +44,7 @@ class Template < ApplicationRecord
belongs_to :account
belongs_to :folder, class_name: 'TemplateFolder'
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy
has_one :search_entry, as: :record, inverse_of: :record, dependent: :destroy if SearchEntry.table_exists?
before_validation :maybe_set_default_folder, on: :create