Displaying 1 result from an estimated 1 matches for "thisismystr".
2009 Aug 28
5
Finding data which, when tweaked, matches.
...ot;.
I have a column in a table which also stores strings. I want to find all
rows which match that string of numbers in that order.
That is, "012345678" will match, but "012-34-5678" will, and
"012sneeze345bless67you8thanks" also will.
Do I have to do something like:
ThisIsMyString = "012345678"
fits = Patient.all.find { |a| a.identifier.delete("^[0-9]") ==
ThisIsMyString }
.. Or can I do something WITHOUT getting all the data, a kind of
Patient.find but with a tweak on the sql query?
--
Posted via http://www.ruby-forum.com/.