Ruby on Rails pagination functionalities done by installing the simple will_paginate plugin. This can be installed by using the following command executed on your ruby for Windows,
Once installed, you need to include the plugin library as
c:\wamp\Ruby>gem install will_paginate
require ‘will_paginate’
in the config/environment.rb bottom after the below code in the .rb file,
Rails::Initializer.run do |config|
end
Live pagination in code:
Add the below code in your model to access by all the controller methods,
def display_data
if (page!=”)
paginate(:all,:page => page, :conditions => ["user_id = ?", id], :per_page =>10)
else
paginate(:all,:page => 1, :conditions => ["user_id = ?", id], :per_page =>10)
end
call the below function in your controller to invoke the paginate from the disaply_data as follows,
@display_data = MessageHistory.more_update(params[:date],params[:page],session[:user_id])
Now here we need to show the pagination in the User view, for that we need to add the below code to invoke the pagination from the controller.
<%= will_paginate @display_data %>
Thats all We have Compeleted the pagination. Once the above run sucessfully you will get the pagination like in the below format on your web page.

For the CSS updates goto this links and copy the CSS and place it in your project folder (public/stylesheet)
http://www.dynamicdrive.com/style/csslibrary/item/css_pagination_links/