#---
# Excerpted from "Rails Recipes"
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/fr_rr for more book information.
#---
class ProductsController < ApplicationController
  
  def index
    conditions = params[:search].blank? ? nil : ['name like ? or description like ?', "%#{params[:search]}%", "%#{params[:search]}%"]
    @pages, @products = paginate :products, :conditions => conditions
  end
  
  def show
    @product = Product.find params[:id]
  end
  
end
