module Dunlop
  module ApplicationRecordAdditions
    extend ActiveSupport::Concern
    include Dunlop::ApplicationRecordAdditions::EpochWeeks

    included do
      self.abstract_class     = true
      self.inheritance_column = :sti_type
    end

    def decorate
      self
    end

    if Rails::VERSION::MAJOR < 5
      def saved_changes
        changes
      end
    end

    module ClassMethods
      def truncate
        #connection_pool.with_connection { |c| c.truncate table_name }
        delete_all
      end

      def decorate
        self
      end
    end
  end
end
