Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@taylorthurlow
Copy link

@taylorthurlow taylorthurlow commented Aug 9, 2024

Closes #128 and fixes compatiblity with Rails/ActiveRecord >= 7.2.

@taylorthurlow taylorthurlow marked this pull request as ready for review August 9, 2024 21:34
@taylorthurlow
Copy link
Author

taylorthurlow commented Aug 9, 2024

Master branch ActiveRecord tests are failing due to Ruby version requirements, and there is no official release of 7.2 yet, so I added a 7.2.0.rc1 gemfile, though it would probably not make sense to merge that.

@taylorthurlow taylorthurlow marked this pull request as draft August 9, 2024 21:39
@taylorthurlow
Copy link
Author

taylorthurlow commented Aug 9, 2024

Thought that our only hurdle was the registration of the adapter but it's failing now due to quote_column_name being called on the AbstractAdapter and it's not immediately obvious to me how to fix it. Defining the Quoting module on the nulldb adapter doesn't seem to have fixed it.

Open to suggestions, not sure how many other changes are going to be required to make this work.

@eclectic-coding
Copy link

Thanks for your work on this PR that is needed. Just a couple of observations.

First, have you tried updating the gemspec to include 7.2?
s.add_runtime_dependency 'activerecord', '>= 5.2.0', '<= 7.2'

Second, 4 of the 8 failing checks are because of the Ruby requirements for Rails 7.2 (> = 3.1). I think if you add some additional exclusion to the workflow for rubies < 3.1 for gemfile: "activerecord_7.0" it should clear these errors up.

Again, thanks for your work, it is appreciated.

@taylorthurlow taylorthurlow force-pushed the fix/activerecord72-register-adapter branch from 0a2472d to 8183e9d Compare August 14, 2024 16:38
@taylorthurlow
Copy link
Author

taylorthurlow commented Aug 14, 2024

@eclectic-coding Thanks for looking and checking things out. I neglected to clean things up because I wasn't able to move forward with the 7.2 changes, and I had missed a few version exclusions as you pointed out. I added those in but the original problems with AR 7.2 still stand. Rails (and AR) 7.0 and 7.1 support Ruby 2.7 officially, and 7.2 now supports back to Ruby 3.1.

Nonetheless, the issues with 7.2 and Ruby 3.1 to 3.3 still stand.

All of the Ruby 2.5 tests are now failing as well, not sure if it's some bundler thing or a change to Actions' test matrix support for Ruby 2.5. Looks like some YAML parsing backtrace but I haven't investigated.

@taylorthurlow
Copy link
Author

taylorthurlow commented Aug 14, 2024

I dug around some more, monkey patched the Quoting.quote_column_name to just wrap in single quotes. I assume this isn't too much of an issue as any other AR adapter gems that this gem coexists with in a given project will be expected to define their own quote_column_name method. No easier solution is clear to me at this point given that most of the nulldb core.rb class just calls super to use the AbstractAdapter implementation, and that doesn't look to be an option here. I also fixed the next issue that popped up which was just a missing kwarg.

I also removed Ruby 2.5 and AR 5.2 from the test matrix and other applicable areas, as those tests were failing and this seems like a good a time as any to drop support for these extremely EOL versions, given that existing versions of nulldb adapter work fine with them. Obviously that can be left in or not, but the tests were failing for a reason unrelated to this PR.

@taylorthurlow taylorthurlow marked this pull request as ready for review August 14, 2024 17:20
@eclectic-coding
Copy link

So, the activerecord_master, 2.7 and activerecord_master, 3.0 checks are failing because of min. Ruby >= 3.1. Looks like we need to exclude in the workflow for these as well.

The last two checks are failing Unsupported ActiveRecord version 8.0.0.alpha. Could this be because we are specifying 7.2 ?

Thanks again.

@eclectic-coding
Copy link

Are there any updates on the approval of this PR?

Right now this is a blocker for any application upgrading to Rails 7.2.

Thanks again for the effort and work.

@fragkakis
Copy link

Same, blocks us from upgrading to Rails 7.2

@abhishekbuilderai
Copy link

Hey @taylorthurlow I tried using your branch directly to my rails backend app (obv. while trying t upgrade to 7.2) and but it still throws the same error.
can you please suggest?

Screenshot 2024-09-17 at 12 31 40 PM

@fwolfst
Copy link

fwolfst commented Sep 27, 2024

Hey @taylorthurlow I tried using your branch directly to my rails backend app (obv. while trying t upgrade to 7.2) and but it still throws the same error. can you please suggest?
Screenshot 2024-09-17 at 12 31 40 PM

@abhishekbuilderai For me it works. Change your Gemfile to this

gem 'activerecord-nulldb-adapter', git: 'https://github.com/taylorthurlow/nulldb', branch: 'fix/activerecord72-register-adapter'

and run bundle.

@taylorthurlow
Copy link
Author

Should be superseded by #136, as it includes these changes but also adds support for ActiveRecord 8.

@cabello cabello merged commit c763f45 into nulldb:master Nov 14, 2024
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.

Doesn't work with edge Rails

6 participants