I am using will_paginate for the first time. My initial implementation is working great. Something like:
@products = Product.paginate(:page => params[:page], :per_page => 10)
In the Product controller, this produces what I was expecting, and I can flip through product listings fine. What I'm trying to do now is show only products that contain the word "glass", and can't figure out how to get it done. Any ideas?
Use a where
clause like this (assuming @product.name
should contain "glass"):
@products = Product.where('name LIKE ?', '%glass%').paginate(...)
Don't forget the paginate
arguments, which I removed for clarity.