txt = "I'm happy :)" #This is input from user
txt = txt.gsub("'","\\'")
raise :test
I'm getting "Im happy :)m happy :)"
I want to get this string variable's value is "I\'m happy :)" (with one backslash)
I'm using Rails. I will use this string variable to parameter for this situation I cannot use "puts" method. I tried many methods(%W(...), %(...)) to solve but I couldn't it yet.