> @cat_products = Product.paginate(:per_page => 5, :page => params
> [:page],
>                                  :conditions => {['title like ?' , "%#
> {params[:search]}%"], :category_id => params[:id]},
>                                  :order => 'title')
You're mixing 2 styles of defining conditions here.  You should be
able to do this:

Product.paginate(:per_page => 5,
                         :page => params[:page],
                         :conditions => ["title LIKE ?", "%#{params
[:search]}%", params[:id]],
                         :order => 'title')

The :conditions array accepts either a string with ? placeholders
followed by parameters in a list:
["title = ? AND name = ?, arg1, arg2]

or a string with symbol placeholders followed by a hash:
["title = :title AND name = :name", {:title => "foo", :name => "bar"}]

Hope that explains it and helps.

Steve

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to