Upgrade to Rails 4.2.0: string literals where conditions are quoted
While updating the version rails
in my application from 4.1.8
to 4.2.0
, I got the following problem.
String literals in conditions are where
now additionally wrapped in quotation marks, which then become part of the query string, no longer producing any valid results. This only happens for database fields of type text
( varchar
not affected). I am using MySQL database.
> Table.where(column: 'data')
[08:19:20.822552] Table Load (0.3ms) SELECT `table`.* FROM `table`
WHERE `table`.`column` = '\"data\"'
Now if you have a row containing a data
value in a column row, this condition will no longer match (obviously "data"
no longer match).
In Rails 4.1.8 everything worked fine:
> Table.where(column: 'data')
[08:19:58.303366] Table Load (0.4ms) SELECT `table`.* FROM `table`
WHERE `table`.`column` = 'data'
I don't know if this is the default or configurable. I still haven't found a related release note. I would be very grateful for any suggestions on what has changed and how best to fix it.
Many thanks for the help!
source to share