Sha256: cdc08cbe47ae9683298b303375734d605ba55c8f341cb05e5117f5b851516ac3

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

module Paginate
  module ActiveRecordExt
    def inherited(subclass)
      super(subclass)
      subclass.send(:include, Paginate::Extension) if subclass.superclass == ::ActiveRecord::Base
    end
  end
end

module ActiveRecord
  class Base
    class << self
      prepend Paginate::ActiveRecordExt
    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

1 entries across 1 versions & 1 rubygems

Version Path
paginate-4.0.1 lib/paginate/active_record.rb