Will Paginate — Plugin

Will Paginate:

1. Installation:

cmd>git clone git://github.com/mislav/will_paginate.git

2. Git Installation

You don’t have git installed already then install it

Install git from here.

3. Try with this Basic Code:

a. Product model(products Table) contains these fields

id
name
price
description

b. DB has 100 records

c. controller:

def productlist
@products = Product.paginate :page => params[:page]
end

d. productlist.hml.erb

<%= will_paginate @products %>

<ul>
<% @products.each do |c| %>
<li><%= c.id %> – <%= c.name %> – <%= c.price %> – <%=
c.description %></li>
<% end %>
</ul>

Output looks Like:

Links for more help –> http://agilewebdevelopment.com/plugins/will_paginate

Advertisements

2 thoughts on “Will Paginate — Plugin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s