I need to save a record with the field record.name = "blah'"
. It's been saving as "blah\'"
and that gives me an error. I tryied to replace "'"
with "\'"
with .gsub(" ' ","\\\\'")
, but that saves the string as "test1\\\'"
. How could I save a name with qoutes without getting an error ?
Before saving or updating I output the string and it is shown this way: "blah'"
In the controller it is being saved this way:
@bewirtung.save!`
and when I get the query of saving in the server log, I see this string as : `"blah'\"'.
The error is this:
'Remote SQLExecDirect: [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: UPDATE "Object": UPDATE "Object" SET "name" = 'blah\'', "LastChange" = '2018<< ??? >>-04-06 17:28:' from CONNECT:
mysql2-0.3.21-x86 (mingw32) lib/mysql2/client.rb:80:in `block in query'
mysql2-0.3.21-x86 (mingw32) lib/mysql2/client.rb:79:in `query'
activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `block in execute'
activerecord (4.2.7.1) lib/active_record/connection_adapters/abstract_adapter.rb:484