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

Add Rails 7 Support #65

Merged
merged 3 commits into from
Jan 20, 2022
Merged

Conversation

mbell697
Copy link
Contributor

@mbell697 mbell697 commented Dec 7, 2021

Hello and thank you for this library!

This PR adds support for Rails 7. I tried to minimize changes but it did require a couple tweaks to the dev environment in order to support Rails 7. For example the .ruby-version needed to be brought up since Rails 7 require Ruby >2.7.

In terms of code - I only needed to change a single version check to get all tests to pass, I also pulled this check out to a constant for a nice little performance boost and future proofing.

I saw in another PR that there are some issues with Travis - been there :) I'm happy to open a separate PR to move this repo over to use Github Actions assuming it's setup for the repo and that is the direction you'd like to go.

Cheers!

@GeorgeKaraszi
Copy link
Owner

Hey @mbell697 ! Thanks for taking a crack at Rails 7 compatibility. And yes Travis has finally bitten the bullet. If you've got the experience dealing with Github Actions, I welcome the changes to get it up and running. Always nice to see if changes break backwards compatibility 😉.

@DanAndreasson
Copy link

Was there any progress on this? :)

@mbell697 mbell697 force-pushed the mb_add_rails_7 branch 10 times, most recently from 29904ed to 69f924c Compare January 17, 2022 18:34
@mbell697
Copy link
Contributor Author

mbell697 commented Jan 17, 2022

I've updated this PR with the following:

  1. Moved to 7.0 final in place of rc1

  2. Added Github Actions based testing, including up through Ruby 3.1. @GeorgeKaraszi I believe you'll need to enable this on this repo but you can see example output on our fork here: https://github.com/swoop-inc/ActiveRecordExtended/runs/4844805512?check_suite_focus=true

  3. It looks like Rails 5.1/5.2 do not get along with Ruby 3.0/3.1 for reasons unrelated to this gem though I didn't dig in too deeply. I've excluded those combos from the tests.

  4. I pulled in my change to the test suite which switched to transaction based cleaning. Normally I'd keep this as a separate PR but in this case it made testing so much faster that I likely wouldn't have had time to get CI testing working without it.

  5. I had to rework the db:create and db:drop rake tasks to get this working. Previously they were shelling out to createdb and dropdb which was making assumptions about the database connection which were invalid. Now it uses Rails internals and the DATABASE_URL connection string. This was a bit wonky to get working across versions but it seems ok. Perhaps in the future the Rackfile could be refactored to avoid duplication but I'll leave that as future work.

I think this PR is now good to merge for Rails 7 / Ruby 3.0/3.1 support.

Cheers!

@GeorgeKaraszi
Copy link
Owner

This look good! ... Thank you for your hard work on this @mbell697 ... I will plan for a new release this week.

@GeorgeKaraszi GeorgeKaraszi merged commit 3d49e52 into GeorgeKaraszi:master Jan 20, 2022
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.

None yet

3 participants