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. -- Posted via http://www.ruby-forum.com/.
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 e[:name]}
or are you referring to MySQL regular expression search?
Rick Williams wrote:
> 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.
Apparently Analagous Threads
- doveadm: problem listing shared mailboxes using a wildcard
- FLAC: Windows wildcards support
- DO NOT REPLY [Bug 5388] New: wildcards and rsync 3.01+
- Samba4 internal DNS wildcards
- [Bug 3123] New: PermitOpen does not allow wildcards for hosts despite what docs say