diff --git a/app/models/submission.rb b/app/models/submission.rb index 002933e5..4e61c691 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -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 diff --git a/app/models/submitter.rb b/app/models/submitter.rb index b684dfbe..205a3b0c 100644 --- a/app/models/submitter.rb +++ b/app/models/submitter.rb @@ -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: -> { {} } diff --git a/app/models/template.rb b/app/models/template.rb index 41b635a0..59f2c36d 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -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