Module: Walruz::More::Pagination::WillPaginateCollection

Defined in:
lib/walruz/more/pagination/will_paginate_collection.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/walruz/more/pagination/will_paginate_collection.rb', line 7

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

Instance Method Details

#next_page_with_walruzObject



15
16
17
18
19
20
21
# File 'lib/walruz/more/pagination/will_paginate_collection.rb', line 15

def next_page_with_walruz
  if self.walruz_offset.nil? || self.walruz_offset == 0
    next_page_without_walruz
  else
    self.current_page
  end
end