From: Sam Smoot Date: 2008-06-16T07:24:08+09:00 Subject: Re: ruby string format kicks in when doign wild card in activerecord 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 - %' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:1421:in `%' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:1421:in `sanitize_sql_array' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:1390:in `sanitize_sql' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:1163:in `add_conditions!' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:1096:in `construct_finder_sql' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:997:in `find_every' >         from e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/ > active_record/base.rb:418:in `find' >         from (irb):20 > > 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#%.