class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true

  def self.inherited(subclass)
    super

    return unless subclass.superclass == self
    return unless subclass.column_names.include? 'shop_code'

    subclass.class_eval do
      acts_as_tenant(:shop, foreign_key: 'shop_code', primary_key: 'shop_code')
    end
  end
end
