I am in the process of upgrading rails 6 to rails 7, and so I am going incrementally from 6.0.3.5
to 6.1.7.8
Upon running my test suite, I have a failure where expected database records are not being found.. It’s a query on a jsonb column, doing a WHERE IN
with multiple values.
> MyModel.where(:value => ['scrooge', 'magica'])
=> []
If I change that array to a single item, then it returns that row, but doing multiple is no longer working.
Yet, if I do:
> MyModel.where(:value => ['scrooge', 'magica']).to_sql
=> "SELECT "my_model".* FROM "my_model" WHERE "my_model"."value" IN ('"scrooge"', '"magica"')"
> MyModel.connection.execute(_).to_a
=> [{"id"=>1,
"created_at"=>2024-08-06 00:19:02.250423 UTC,
"updated_at"=>2024-08-06 00:19:02.250423 UTC,
"value"=>""scrooge""},
{"id"=>2,
"created_at"=>2024-08-06 00:19:02.252219 UTC,
"updated_at"=>2024-08-06 00:19:02.252219 UTC,
"value"=>""magica""}]
… then I do get results… So, what is going on here?