activerecord-bitemporal
activerecord-bitemporal copied to clipboard
`Or` node changed to `Nary` in Rails 7.2
In https://github.com/rails/rails/pull/51492 the Or node changed from Binary to Nary as well as And.
This PR changed to treat Or as Nary since Rails 7.2.
For example, this test fails: https://github.com/kufu/activerecord-bitemporal/blob/010d79d42418eca0f42ab090070964306dda8a5c/spec/activerecord-bitemporal/bitemporal_scope_spec.rb#L1170
1) ActiveRecord::Bitemporal::Scope bitemporal_scope association .joins with .or and without Time freeze is expected to match /"articles"."transaction_from" <= \$1/
Failure/Error: it { is_expected.to match %r/"articles"."transaction_from" <= \$1/ }
expected "SELECT \"blogs\".* FROM \"blogs\" INNER JOIN \"articles\" ON \"articles\".\"blog_id\" = \"blogs\".\"...blogs\".\"transaction_to\" > $6 AND \"blogs\".\"valid_from\" <= $7 AND \"blogs\".\"valid_to\" > $8)" to match /"articles"."transaction_from" <= \$1/
Diff:
@@ -1 +1 @@
-/"articles"."transaction_from" <= \$1/
+"SELECT \"blogs\".* FROM \"blogs\" INNER JOIN \"articles\" ON \"articles\".\"blog_id\" = \"blogs\".\"bitemporal_id\" WHERE (\"blogs\".\"transaction_from\" <= $1 AND \"blogs\".\"transaction_to\" > $2 AND \"blogs\".\"valid_from\" <= $3 AND \"blogs\".\"valid_to\" > $4 OR \"blogs\".\"transaction_from\" <= $5 AND \"blogs\".\"transaction_to\" > $6 AND \"blogs\".\"valid_from\" <= $7 AND \"blogs\".\"valid_to\" > $8)"
# ./spec/activerecord-bitemporal/bitemporal_scope_spec.rb:1170:in `block (6 levels) in <top (required)>'
# ./spec/activerecord-bitemporal/bitemporal_scope_spec.rb:108:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:38:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:37:in `block (2 levels) in <top (required)>'