Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Or node changed to Nary in Rails 7.2 #173

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Conversation

krororo
Copy link
Collaborator

@krororo krororo commented Jul 16, 2024

In rails/rails#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:

it { is_expected.to match %r/"articles"."transaction_from" <= \$1/ }

  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)>'

@krororo krororo force-pushed the support-rails-7.2 branch from 94b8473 to cf63c2e Compare August 18, 2024 07:46
@krororo krororo marked this pull request as ready for review August 18, 2024 08:18
@auto-assign auto-assign bot requested review from lighty and mkmn August 18, 2024 08:18
@krororo krororo requested a review from osyo-manga August 18, 2024 08:19
@krororo krororo merged commit 8b49855 into kufu:master Oct 29, 2024
10 checks passed
@krororo krororo deleted the support-rails-7.2 branch October 29, 2024 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants