group by?

How can you add an "group by title" clause to:

@books_pages, @books = paginate (:books, :conditions => ['keyid = ?', @key.id], :order => 'id DESC', :per_page => 10 )

Thanks

Hey there mate,

Go to railscast.com i think there is a quick 4 min viedo on it, that should help

You just sent him to a spam search page :frowning:

Correct url:

    #29 group_by Month - RailsCasts

Alain Ravet

If I am not mistaken, with pagination you should be able to use all the parameters that you would on a find. So you could use the :group option.

@books_pages, @books = paginate (:books, :conditions => ['keyid = ?', @key.id], :order => 'id DESC', :per_page => 10, :group => "title" )

Scott

Just watched a few of the railscasts. Most productive 20 minutes I've spent in the past 2 weeks :slight_smile: