Forum: Ruby on Rails How to allow user entered wildcards in find?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
01ec89b682c7ae076d25c39a70def227?d=identicon&s=25 Rick Williams (rick)
on 2005-12-14 16:47
Anyone know how to allow user entered (mySql) wildcards for a find?

It seems that if I do a plain find(:all... with % as the search text it
finds nothing where it seems it should find every row.

I hope this is stated clearly enough.
Ce60c4f78a63b0695e4dafc4bd7964f7?d=identicon&s=25 Lou Vanek (Guest)
on 2005-12-14 21:58
(Received via mailing list)
this worked for me when I gave an arg of "%" and "%ev%":

	conditions = [ "name like ?", args[0] ]
	MyTable.find( :all, :conditions => conditions ).each { |e| puts

or are you referring to MySQL regular expression search?
This topic is locked and can not be replied to.