From: Eric Hodel Date: 2008-06-16T15:05:59+09:00 Subject: Re: ruby string format kicks in when doign wild card in activerecord On Jun 15, 2008, at 15:24 PM, Sam Smoot wrote: > On Jun 15, 4:29 pm, Junkone wrote: >> when i was doing a LIKE statement in my wild card query. Ruby thinks >> that the % is a String Format charactor and throws exception. what >> are >> my options. >> >>>> Rawdata.find(:all , :conditions=>["processed_indicator like 'LF >>>> %'"]) >> >> ArgumentError: malformed format string - %' >> > > Try it without the Array wrapper? Or with a ? place-holder and 'LF%' > as the second element in the Array? Or monkey-patch the > sanitize_sql_array method not to use String#%. Or, escape it with another %. irb(main):003:0> "processed_indicator like 'LF%%'" % [] => "processed_indicator like 'LF%'"