Sha256: ee7f3f11e74dd3407e0f0d333f1c29bdfb71e1bb4c25fc4a2bcdc833639dfe56

Contents?: true

Size: 741 Bytes

Versions: 3

Compression:

Stored size: 741 Bytes

Contents

require 'kaminari/models/active_record_model_extension'

module Kaminari
  module ActiveRecordExtension
    extend ActiveSupport::Concern
    included do
      # Future subclasses will pick up the model extension
      class << self
        def inherited_with_kaminari(kls) #:nodoc:
          inherited_without_kaminari kls
          kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ::ActiveRecord::Base
        end
        alias_method_chain :inherited, :kaminari
      end

      # Existing subclasses pick up the model extension as well
      self.descendants.each do |kls|
        kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ::ActiveRecord::Base
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaminari-0.16.2 lib/kaminari/models/active_record_extension.rb
kaminari-0.16.1 lib/kaminari/models/active_record_extension.rb
kaminari-0.16.0 lib/kaminari/models/active_record_extension.rb