Hello,
I''m try to escape text from ilike but it doesn''t work. when i
type ''%''
it send the request ''%%%'' so it return every record
Here is the function.
def self.autocomplete(text, options={})
text = ''%'' +
self.sanitize_sql(text.downcase.strip.squeeze(" ") )
+ ''%''
self.find(:all, :conditions => [''name ILIKE ?'',
text]).collect(&:name)
end
i even tried with gsub, something like gsub(/([%_])/, ''\\\1'')
to
escape ''%'' and ''_'' but i''m really
familar to this function or regex.
any idea?
regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---