will_paginate not showing

Hi,

I am trying to use the will_paginate helper.

I installed the gem and put "require 'will_paginate'" in the
environment.rb file.

In my controller

@tasks = Task.paginate :page => params[:page], :order => 'date_begin
DESC'

In my view

<%= will_paginate @tasks %>

The view doesn't show anything. Did I miss something ? (the @tasks
variable is not empty)

How many records does @tasks contain?

I think you're missing the :per_page option

@tasks = Task.paginate :page => params[:page], :per_page =>
50, :order => 'date_begin
DESC'

should work.

Thorsten Mueller wrote:

I think you're missing the :per_page option

@tasks = Task.paginate :page => params[:page], :per_page =>
50, :order => 'date_begin
DESC'

should work.

You win :slight_smile:

I though this argument was facultative.

If you don’t specify anything, it will display 30 :per_page

Franz