Sha256: 320cb4f31200e8357070d1acbca08cf66bc85e939a3089eaea569668cb68d2ac

Contents?: true

Size: 584 Bytes

Versions: 10

Compression:

Stored size: 584 Bytes

Contents

require 'kaminari/models/active_record_relation_methods'

module Kaminari
  module ActiveRecordModelExtension
    extend ActiveSupport::Concern

    included do
      self.send(:include, Kaminari::ConfigurationMethods)

      # Fetch the values at the specified page number
      #   Model.page(5)
      self.scope Kaminari.config.page_method_name, Proc.new {|num|
        limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
      } do
        include Kaminari::ActiveRecordRelationMethods
        include Kaminari::PageScopeMethods
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
kaminari-rails4-0.15.0 lib/kaminari/models/active_record_model_extension.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/kaminari-0.14.1/lib/kaminari/models/active_record_model_extension.rb
kaminari-0.14.1 lib/kaminari/models/active_record_model_extension.rb
kaminari-0.14.0 lib/kaminari/models/active_record_model_extension.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/kaminari-0.13.0/lib/kaminari/models/active_record_model_extension.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/kaminari-0.13.0/lib/kaminari/models/active_record_model_extension.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/kaminari-0.13.0/lib/kaminari/models/active_record_model_extension.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/kaminari-0.13.0/lib/kaminari/models/active_record_model_extension.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/kaminari-0.13.0/lib/kaminari/models/active_record_model_extension.rb
kaminari-0.13.0 lib/kaminari/models/active_record_model_extension.rb