RailsCasts Pro episodes are now free!
Learn more or hide this
There is a newer version of this episode, see the revised episode.
Resources
def self.search(search, page) paginate :per_page => 5, :page => page, :conditions => ['name like ?', "%#{search}%"], :order => 'name' end
def index @products = Product.search(params[:search], params[:page]) end
<%= will_paginate @products %>