We are in the process of upgrading to Ruby 1.9.3 from 1.8.7 plus trying to update Rails from 3.2.1 to 3.2.8 or 9. Our app works with Ruby 1.9.3-p327 and Rails 3.2.1, but as soon as I upgrade Rails to any higher version, I start seeing MySQL errors:
(0.2ms) BEGIN
SQL (0.5ms) INSERT INTO `orders` (`cancelled_at`, `completed_at`, `created_at`, `customer_id`, `refunded_at`, `updated_at`, `uuid`, `website_id`, `workflow_state`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, ?, ?, ?, ?, ?, ?, ?, ?)' at line 1: INSERT INTO `orders` (`cancelled_at`, `completed_at`, `created_at`, `customer_id`, `refunded_at`, `updated_at`, `uuid`, `website_id`, `workflow_state`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
(0.1ms) ROLLBACK
Completed 500 Internal Server Error in 194ms
ActiveRecord::StatementInvalid (Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, ?, ?, ?, ?, ?, ?, ?, ?)' at line 1: INSERT INTO `orders` (`cancelled_at`, `completed_at`, `created_at`, `customer_id`, `refunded_at`, `updated_at`, `uuid`, `website_id`, `workflow_state`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)):
app/controllers/search_controller.rb:231:in `build_new_order'
app/controllers/search_controller.rb:432:in `add_to_cart?'
app/controllers/search_controller.rb:37:in `new'
And all we're doing is a basic:
@order = Order.create! @website
If we just call Order.new or Order.create and check the validity of @order, it passes (@website is also valid). Call save!, we get the MySQL error. We can run the same Order.create! in the console and it passes!!
Also, once we see see the error, then the whole site errors. We've seen some issues with Workflow and have 'downgraded' it to 0.8.1. I've tried different versions of MySQL2 (currently using 0.3.11). I've tried using activerecord-mysql2-adapter instead and the site blows up completely. I haven't tried a different version of Paper Trail (currently using 2.6.4) and maybe I'm concentrating too much on the model since it works on in the console. However, the controller does work until we try to add something to the cart and create an Order.
Searching the web, rails website, workflow, mysql2 and stack overflow hasn't turned up anything.
Has anyone else ran into something similar? Any other suggestions would be appreciated. Thanks!
EDIT:
The release notes for 3.2.2 say "Query cache instrumentation includes bindings in the payload". So I searched for 'cache instrumentation' and found this: