Sha256: d93b702a25613a7d5771e13f8a2ffd671beeea561b6fa9dea0e3a587d648e225

Contents?: true

Size: 437 Bytes

Versions: 2

Compression:

Stored size: 437 Bytes

Contents

if defined?(WillPaginate)
  module WillPaginate
    module ActiveRecord
      module RelationMethods
        def per(num)
          if (n = num.to_i) <= 0
            self
          else
            limit(n).offset(offset_value / limit_value * n)
          end
        end

        def total_pages
          (total_count.to_f / limit_value).ceil
        end

        alias_method :total_count, :total_entries

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bcms_spree-0.0.2 config/initializers/will_paginate.rb
bcms_spree-0.0.1 config/initializers/will_paginate.rb