Topic: Single Quote Escaping
Hi everyone!
I have a ruby-on-rails application that stores a list of strings. Some strings include a single quote, e.g. the word "don't". Because I have many such words, I use the rails console for adding new items. Storing them in the database is fine -- here I just escape the single quote
w.word = 'don\'t'
w.save
But now when I try to find this word again, I get problems
w.find(:all, :conditions=>["word='don\'t'"])
This no longer works. I get a syntax error. I also tried with three \ but this also yields a syntax error. What can I do?
Thank you very much for your help !!
Last edited by patrick007 (2011-04-10 13:06:22)