Search code examples
ruby-on-railsrubyruby-on-rails-3.2passengerruby-2.1

SQL Errors when running Rails 3.2.19 with Ruby 2.1.5 with Passenger 4.0.57


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

  1. Is ruby 2.1.5 compatible with Rails 3.2.19?
  2. Can this issue be related to the ruby or Passenger upgrade or is it a bug in our application that is causing this? How can we go about debugging this?

Solution

  • 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.