Forum: Ruby on Rails will_paginate problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
32edf22df6932b252d7be5a1b9b766c9?d=identicon&s=25 Stephen Fagan (railsman)
on 2009-05-05 15:00
Hi all,

I'm having a bit of a problem with displaying a blog list using the
will_paginate helper. My code is:

entries_controller:

def index
@entries = Entry.find(:all)
@blog_entries = @entries.paginate( :page => params[:page], :per_page =>
4,
                                           :include => :user,
                                           :order => 'topics.updated_at
DESC')
end

Basically I am trying to display a blog index which is the contents of
the Entry table. In my index view I have:

<%= will_paginate @blog_entries %>

But nothing happens when I add more than 4 blog entries. Where am I
going wrong?

Thanks

Stephen
A91bd6cef23eb3516245a092e196c4da?d=identicon&s=25 Maurício Linhares (mauricio)
on 2009-05-05 15:04
(Received via mailing list)
I guess this is what you're trying to do:

def index
    @blog_entries = Entry.paginate( :page => params[:page], :per_page
=> 4, :include => :user, :order => 'topics.updated_at )
end

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)



On Tue, May 5, 2009 at 10:00 AM, Stephen Fagan
This topic is locked and can not be replied to.