ctes_in_my_pg icon indicating copy to clipboard operation
ctes_in_my_pg copied to clipboard

Branch rails_6_1 does not work with latest Rails 6.1.4

Open serch opened this issue 4 years ago • 6 comments

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.

serch avatar Jul 05 '21 05:07 serch

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

booleanbetrayal avatar Jul 14 '21 16:07 booleanbetrayal

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

kmurph73 avatar Jul 14 '21 18:07 kmurph73

@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

serch avatar Jul 15 '21 05:07 serch

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.

kmurph73 avatar Jul 28 '21 17:07 kmurph73

@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!

serch avatar Jul 29 '21 07:07 serch

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

xxx avatar Jul 30 '21 21:07 xxx