Rails 4.2.6 upgrade to 5.0.7 (PG::ProtocolViolation: ERROR)

Viewed 82

I have migrated my Rails 4.2.6 App to 5.0.7, however I have the following major issue:

PG::ProtocolViolation: ERROR:  bind message supplies 0 parameters, but prepared statement "" requires 2

Here's the query that I'm executing:

@items = Discount.includes(:status).where(status: {status: 'active'}, client_id: current_client_id)

After some research, I've found that this is related to ActiveRecord, and here's a "patch" that works: Github issue

Basically, what is proposed there is to add brackets to the where parameters.

@items = Discount.includes(:status).where(status: {status: ['active']}, client_id: [current_client_id])

And indeed, this is working OK

Question:

Does anyone know the bottom line issue of this? Do I need to apply this "patch" to ALL my AR queries?

I really would like to find a solution to this, if there's no other solution I'd be changing +600 queries along all my app.

Any help will be appreciated.

0 Answers
Related