Hello all,will_paginate don't work on jruby platform, the Model.paginate find works ok, accepts all kinds of params, this is config.gem config.gem 'will_paginate', :version => '2.3.11', :source => 'http://gemcutter.org', but <%= will_paginate @collection %> doesn't work it always produce nil(so nothing on page). weird.
are you sure you have installed the GEM ?
Thanks & Regards, Dhruva Sagar.
Yes, the paginate find method in controller works.(Model.paginate blah blah blah) but <%= will_paginate @collection %> doesn't work on view.
Well then are you sure that the query (conditions etc) that your running on the paginate method should infact return results ?
Check the logs and see the query running in the background and see if that query does return some records in the @collection.
Thanks & Regards, Dhruva Sagar.
Alternatively I would also recommend you to try and do the same on the script/console and see if the paginate method is returning what you intend to return.
Thanks & Regards, Dhruva Sagar.
Hello Dhruva, I have done a test, when like say, @audits = Audit.paginate(:all, :page => params [:page], :per_page=>params[:per_page] ...) or(@audits = Audit.paginate(:page => params[:page], :per_page=>params [:per_page] ...)) ignore the first parameter, it all returns a will_pagination not correctly set @total_pages, @total_entries etc.(set @total_entries to 3, set @total_pages to 1, which is totally wrong where I have many audits) I've manual set its @total_pages, then <%= will_paginate @audits %> works, generate the pagination link, so I guess the problem lies somewhere in Audit.paginate doesn't correctly set @total_pages, @total_entries.
audits' count is 202, which is obviously so the .paginate set @total_entries to 3, set @total_pages to 1 is obviously wrong.weird..