Sha256: 8300792915e5af200cfcf4449643a8059e200f1377c34b470a1bbf236727718e

Contents?: true

Size: 652 Bytes

Versions: 10

Compression:

Stored size: 652 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)
      eval <<-RUBY
        def self.#{Kaminari.config.page_method_name}(num = nil)
          limit(default_per_page).offset(default_per_page * ((num = num.to_i - 1) < 0 ? 0 : num)).extending do
            include Kaminari::ActiveRecordRelationMethods
            include Kaminari::PageScopeMethods
          end
        end
      RUBY
    end
  end
end

Version data entries

10 entries across 10 versions & 6 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/kaminari-0.17.0/lib/kaminari/models/active_record_model_extension.rb
kaminari-0.17.0 lib/kaminari/models/active_record_model_extension.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/kaminari-0.16.3/lib/kaminari/models/active_record_model_extension.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/kaminari-0.16.3/lib/kaminari/models/active_record_model_extension.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/kaminari-0.16.3/lib/kaminari/models/active_record_model_extension.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/kaminari-0.16.3/lib/kaminari/models/active_record_model_extension.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/kaminari-0.16.3/lib/kaminari/models/active_record_model_extension.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/kaminari-0.16.3/lib/kaminari/models/active_record_model_extension.rb
kaminari-0.16.3 lib/kaminari/models/active_record_model_extension.rb
kaminari-0.16.2 lib/kaminari/models/active_record_model_extension.rb