Sha256: a0b4effa5a4d397009842a4c3de6c621f7ccae1ae4451b6f0b9f9fbc3b0ab1c8

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

module Walruz
  module More
    module Pagination

      module WillPaginateCollection

        def self.included(base)
          base.class_eval do
            attr_accessor :walruz_offset
            alias_method :next_page_without_walruz, :next_page
            alias_method :next_page, :next_page_with_walruz
          end
        end
        
        def next_page_with_walruz
          if self.walruz_offset.nil? || self.walruz_offset == 0
            next_page_without_walruz
          else
            self.current_page
          end
        end

      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
walruz-0.0.16 lib/walruz/more/pagination/will_paginate_collection.rb
walruz-0.0.15 lib/walruz/more/pagination/will_paginate_collection.rb
walruz-0.0.14 lib/walruz/more/pagination/will_paginate_collection.rb
walruz-0.0.13 lib/walruz/more/pagination/will_paginate_collection.rb
walruz-0.0.12 lib/walruz/more/pagination/will_paginate_collection.rb