Hi guys: I''m trying go through a table, read a field, escape out all
the
single quotes in there, and write it back again. For some reason my
gsub, even though by all accounts looks right, doesn''t seem to be
working. Here is my code:
...
y.text.gsub("''","\\\\''")
thesql = "text = ''"+y.text+"''"
Capture.update_all( thesql, "id = "+y.id.to_s  )
...
Constantly breaks on an entry that includes
"It''s going up on..."
right at the '' in It''s.
Any ideas? I even wrote a loop to recurse through the string and make
sure that I was a really a single quote (39)
Thanks...Chris
-- 
Posted via http://www.ruby-forum.com/.
-- 
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
> y.text.gsub("''","\\\\''")Nothing is changing here. You need to add a bang. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sharagoz -- wrote:>> y.text.gsub("''","\\\\''") > Nothing is changing here. You need to add a bang.Doh! Thanks. I was using the same code elsewhere but without the bang. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.