Rails 3, will-paginate; How to show multiple items in a row?
So I'm trying to Paginate an array of items on a page in a grid format, with 3 items per row. It should allow for 6 rows per page. Similar to this, actually: http://www.logicbuy.com/ It seems like it should be relatively simple to i开发者_JS百科mplement with will-paginate, but I can't find any information on the web or on this site. Any ideas?
Checkout the wiki pages for will_paginate
https://github.com/mislav/will_paginate/wiki/. You can specify the page size in your find like:
class Coupon < ActiveRecord::Base
cattr_reader :per_page
@@per_page = 18
end
Then find your coupons @coupons = Coupon.paginate :page => params[:page]
and render @coupons
like you already are doing.
And finally, provide the pagination links, <%= will_paginate @coupons %>
.
Let me know if you need any more explanation or help, but I suggested reading over the wiki pages if you haven't already.
精彩评论