kmurph73 / ctes_in_my_pg

ActiveRecord support for PostgreSQL's CTEs
MIT License
39 stars 23 forks source link

Branch rails_6_1 does not work with latest Rails 6.1.4 #10

Open serch opened 3 years ago

serch commented 3 years ago

It seems the release of Rails 6.1.4 broke the branch rails_6_1 of the gem.

One error is that build_arel changed its signature from

def build_arel(aliases)

to

def build_arel(aliases = nil)

I fixed this in my fork of the gem but I was still having issues in my test suite, it seems the tests were halting. Hopefully I'll have time later this week to take a look at this, however I figured I would still open the issue to let you guys know.

booleanbetrayal commented 3 years ago

@serch - Have you pushed these changes in your fork by chance?

kmurph73 commented 3 years ago

Thanks for the report... missed this initial email of course. Pretty busy today but will look into it asap.

serch commented 3 years ago

@serch - Have you pushed these changes in your fork by chance?

@booleanbetrayal this is the only commit I made https://github.com/Monsido/ctes_in_my_pg/commit/e5cef65e6799e4fdd3cf83d82c062340e1953bf5

kmurph73 commented 3 years ago

Wasn't able to reproduce this issue (not using this gem currently). However I pushed a rails_6_1_4 branch, that adjusts build_arel's signature

Can someone try it out and report back? Thank you.

serch commented 3 years ago

@kmurph73 thanks for the fix!

I tested it against the test suite at work where we only have 3 CTEs and those worked just fine some other tests that use update_all were failing though, this is a sample stacktrace:

1) Error:
TestClassTest::#test_method!#test_0001_test description:
NoMethodError: private method `build_arel' called for #<ActiveRecord::AssociationRelation []>
Did you mean?  build_where_clause
  /Users/my-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4/lib/active_record/relation/delegation.rb:110:in `method_missing'
  /Users/my-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4/lib/active_record/associations/collection_proxy.rb:1109:in `build_arel'
  /Users/my-user/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4/lib/active_record/relation.rb:443:in `update_all'
  /Users/my-user/my-app/test/models/test_class.rb:24:in `block (2 levels) in <class:TestClassTest>'

so I commented out the private modifier, ran the entire suite again, and all tests are green now!

xxx commented 3 years ago

@kmurph73 The rails_6_1_4 branch works for us. We didn't run into the visibility issue that @serch mentions above.