Currently our Rails app is running on Ruby 1.9.3 and Passenger 3.0.19. But when we upgraded Ruby to version 2.1.5 and Passenger to 4.0.57 the application started generating weird sql queries similar to the following
ActiveRecord::StatementInvalid (Mysql2::Error: [34816] syntax error: improper query string termination: SELECT (End of query)
ActiveRecord::StatementInvalid (Mysql2::Error: [8192] Relation not found: no such relation ": SELECT ` (End of query)
Mysql2::Error: [32768] Translate error: SQL-ERROR: unable to resolve relation "": SELECT agents.* FROM agents WHERE ``.id = 22241082 LIMIT 1
ActiveRecord::StatementInvalid (Mysql2::Error: [32769] Unknown column: SQL-ERROR: unable to resolve column "agents.: SELECT agents.* FROM agents WHERE agents.` (end of query)
One update query with where clause "0 = 0"
We need help with the following questions
We finally figured out that the issue to be related to some old gems which was part of our code base. Upgrading them to be compatible with Ruby 2.x fixed the issue.