Sha256: 0f059ec83721cd75bf6e3a00931b38fc64196f27bc1086111f063b3ca35f06cb

Contents?: true

Size: 950 Bytes

Versions: 7

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true

module GoodJob
  # Base ActiveRecord class that all GoodJob models inherit from.
  # Parent class can be configured with +GoodJob.active_record_parent_class+.
  # @!parse
  #   class BaseRecord < ActiveRecord::Base; end
  class BaseRecord < ActiveRecordParentClass
    self.abstract_class = true

    def self.migration_pending_warning!
      GoodJob.deprecator.warn(<<~DEPRECATION)
        GoodJob has pending database migrations. To create the migration files, run:
            rails generate good_job:update
        To apply the migration files, run:
            rails db:migrate
      DEPRECATION
      nil
    end

    # Checks for whether the schema is up to date.
    # Can be overriden by child class.
    # @return [Boolean]
    def self.migrated?
      return true if table_exists?

      migration_pending_warning!
      false
    end

    ActiveSupport.run_load_hooks(:good_job_base_record, self)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
good_job-3.17.1 app/models/good_job/base_record.rb
good_job-3.17.0 app/models/good_job/base_record.rb
good_job-3.16.4 app/models/good_job/base_record.rb
good_job-3.16.3 app/models/good_job/base_record.rb
good_job-3.16.2 app/models/good_job/base_record.rb
good_job-3.16.1 app/models/good_job/base_record.rb
good_job-3.16.0 app/models/good_job/base_record.rb