Hi all,

im new on ruby and im experimentig with find method. I've made a "ñapa"
as we say in Spain to solve a problem, that detects the params and
creates the params for find:

    ------------   CODE    ----------------------
    if(cont==1)
      hash = [cad,"%#{queryArray[0]}%"]
    elsif(cont==2)
      hash = [cad,"%#{queryArray[0]}%","%#{queryArray[1]}%"]
    [......]

cad = 'title OR description LIKE ? AND title OR description like ?'

@products =  Product.find(:all, :conditions =>  hash)
------------   CODE    ----------------------

obviously the conditional part is very ugly, but i´ve been looking to
build it dinamically with no success. This is the content which it
should be desirable to autogenerate deppendig on queryArray size:

['title OR description LIKE ? AND title OR description like ?',
"%#{queryArray[0]}%", "%#{"queryArray[1]"}%", "%#{"queryArray[2]"}%",
.... ]

Is it possible to make it in ruby? Thanks a lot in advance
-- 
Posted via http://www.ruby-forum.com/.