Sha256: 36cac3a57b89b5959000ea9c1eeca99575b0f6960f82eeb84dcef9f88c4cf1a4

Contents?: true

Size: 478 Bytes

Versions: 2

Compression:

Stored size: 478 Bytes

Contents

module ActiveRecord
  class Base
    class << self
      def inherited_with_paginate(subclass)
        inherited_without_paginate subclass
        subclass.send(:include, Paginate::Extension) if subclass.superclass == ActiveRecord::Base
      end

      alias_method_chain :inherited, :paginate
    end

    # Extend existing models
    self.descendants.each do |model|
      model.send(:include, Paginate::Extension) if model.superclass == ActiveRecord::Base
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paginate-4.0.0 lib/paginate/active_record.rb
paginate-3.0.0 lib/paginate/active_record.rb