この場合、ページネーションをどのように実装しますか..次のページをすでに計算しているgemを使用しています。@client.videos_by(:tags=>{:include=>[:cover,:acoustic]},:page=>2)
(page は、ページ番号を受け入れる gem のメソッドです) このクエリは、2 ページ目のみの動画の配列を返します。3 で置き換えると、3 ページ目のみが返されます。次のページを実装するにはどうすればよいですか? これは私が試したものですが、[次へ]をクリックすると、毎回最初のページが返され続けます。
コントローラ
class StarsController < ApplicationController
@@current||=1
def index
@videos=@client.videos_by(:tags=>{:include=>[:cover,:acoustic]},:page=>@@current)
end
def next
@@current+=1
redirect_to :action=>'index'
end
end
意見
<%= link_to "next",:controller=>"stars",:action=>"next" %>