RailsCasts Pro episodes are now free!
Learn more or hide this
Resources
config.gem "mislav-will_paginate", :lib => "will_paginate", :source => "http://gems.github.com"
def index @products = Product.paginate(:per_page => 10, :page => params[:page]) end
<%= javascript_include_tag 'jquery' %>
$("#products").html("<%= escape_javascript(render("products")) %>");
$(function() { $(".pagination a").live("click", function() { $(".pagination").html("Page is loading..."); $.getScript(this.href); return false; }); }); // For older jQuery versions... // jQuery.ajaxSetup({ // 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} // });