paginateが無くなった。

なんてこったい!移行作業が進まないじゃないか!!

苦労しているのは自分だけではないらしく、さっそくまとめている方がいた。
http://d.hatena.ne.jp/yotena/20071211/1197378238

paginating_findとwill_paginate

Rails1系のとき

iftb_controller.rb

#searchの一部分

params[:page] = 1 if params[:page].nil?
conditions = @iftb_cond.get_conditions

if conditions[0] == "" then
  @count = Iftb.count()
  @iftb_pages, @iftbs = paginate :iftbs, :per_page=>10, :order=>'dtend DESC'
else
  @count = Iftb.count(:conditions=>conditions)
  @iftb_pages, @iftbs = paginate :iftbs, :per_page=>10,
  :conditions=>conditions, :order=>'dtend DESC'
end

「_paginate.rhtml」

<div class='iftb_pagenate'>検索結果ページ: <%=h @count %>件中 
<%= @iftb_pages.current.first_item %> - <%= @iftb_pages.current.last_item %>件目<br />
<%= link_to "前へ", :page => @iftb_pages.current.previous if @iftb_pages.current.previous %>
<%= pagination_links @iftb_pages %>
<%= link_to "次へ", :page => @iftb_pages.current.next if @iftb_pages.current.next %>
</div>

これではダメらしい。

Rails2系のとき

iftb_controller.rb

#searchの一部分
if conditions[0] == "" then
  @count = Iftb.count()
  @iftb_pages, @iftbs = will_paginate(:iftbs, :per_page=>10, :order=>'dtend DESC')
else
  @count = Iftb.count(:conditions=>conditions) 
  @iftbs = Iftb.paginate(:page=>params[:page], :per_page=>10,:conditions=>conditions, :order=>'dtend DESC' )
end

「_paginate.rhtml」

<div class='iftb_pagenate'>検索結果ページ: <%=h @count %>件中 
<%= will_paginate @iftbs, :prev_label => '<<前' , :next_label => '次>>', :inner_window => 4 -%>
</div>||<