Sha256: cea3514707939964409d1e9158940b505ec1330b0d054c42261d05023e8da7e7

Contents?: true

Size: 413 Bytes

Versions: 4

Compression:

Stored size: 413 Bytes

Contents

class ActiveRecord::Base
  class << self
    alias_method :original_inherited, :inherited
  end

  def self.inherited(child)
    original_inherited(child)

    child.class_eval do
      if Rails.version >= "3.0"
        scope :paginate, proc {|*args| Paginate::Base.new(*args).to_options }
      else
        named_scope :paginate, proc {|*args| Paginate::Base.new(*args).to_options }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paginate-0.1.3 lib/paginate/active_record/ext.rb
paginate-0.1.2 lib/paginate/active_record/ext.rb
paginate-0.1.1 lib/paginate/active_record/ext.rb
paginate-0.1.0 lib/paginate/active_record/ext.rb