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

feat: Add support for Rails 7.1 #1573

Merged
merged 9 commits into from
Nov 17, 2023

Conversation

matsales28
Copy link
Member

@matsales28 matsales28 commented Oct 6, 2023

Adding support for Rails 7.1 version, there are several commits each one fixing one problem in the specs. I'd recommend going through them one by one when reviewing, it'll be easier to review.

…ation

This commit adjusts the way we manage columns and tables in migrations
to account for the changes in Rails 7.1.0, it was introduced in this
Rails version a validation around the options passed to tables and
columns in migrations, so we need to adjust our code to skip this
validation.

This PR introduced this new validation on the migrations:
rails/rails#46178
@matsales28 matsales28 self-assigned this Oct 6, 2023
@matsales28 matsales28 force-pushed the feat/support-rails7.1 branch from 86a4d80 to 6365ea5 Compare October 6, 2023 18:43
This commit refines the `ActiveRecord::SerializeMatcher` to
accommodate changes in the public API introduced in Rails 7.1.
The `serialize` method's API has been updated, necessitating
adjustments to our matcher specs to align with the new API.

While this PR addresses the immediate need for compatibility,
there is potential for further enhancements and refinements in
the matcher's implementation to bring it in line with the revised
public API. However, such improvements will be explored in a future PR.

For reference, the changes in the public API can be found in the following PR: rails/rails#47463

This commit adjusts the `ActiveRecord::SerializeMatcher` the public
API for the `serialize` method has changed on Rails 7.1, so we
had to
@matsales28 matsales28 force-pushed the feat/support-rails7.1 branch from 6365ea5 to e836d24 Compare October 27, 2023 18:38
The behavior of the comparison between hash and a
`ActionController::Parameters` was changed and now will be deprecated.

Check this Rails PR for more context
rails/rails#44826.
The behaviour of this method was changed in Rails 7.1, and now
it'll search for a `token` attr in the initialization of the record
instead of the creation. To stay with the same behaviour as before
it's necessary to pass a new argument `on: : create` to the method.
@matsales28 matsales28 force-pushed the feat/support-rails7.1 branch from 0a27956 to 75612f6 Compare October 28, 2023 01:03
This commit fixes the problem of not finding the tables
when running the specs in eager load mode, this was introduced
by Rails 7.1.

Load the model schema when running test in eager load
context rails/rails#49470
@matsales28 matsales28 force-pushed the feat/support-rails7.1 branch from b12fde3 to aae4ed2 Compare November 10, 2023 16:01
@matsales28 matsales28 marked this pull request as ready for review November 10, 2023 16:03
@matsales28 matsales28 requested a review from vsppedro as a code owner November 10, 2023 16:03
Copy link
Collaborator

@vsppedro vsppedro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I'm thinking of making a new version of shoulda-matchers once we incorporate support for Ruby 3.2. What are your thoughts on this idea?

@matsales28
Copy link
Member Author

I'm thinking of making a new version of shoulda-matchers once we incorporate support for Ruby 3.2. What are your thoughts on this idea?

@vsppedro I like the idea, but do you mean support for Ruby 3.3, right? If I'm not wrong we are already supporting Ruby 3.2. I have never released a new version of a gem. If we can do that together somehow I'd love to participate.

@matsales28 matsales28 merged commit 7e069cf into thoughtbot:main Nov 17, 2023
13 checks passed
@matsales28 matsales28 deleted the feat/support-rails7.1 branch November 17, 2023 19:08
@vsppedro
Copy link
Collaborator

vsppedro commented Dec 7, 2023

@matsales28, yes, for 3.3. It's a great idea for you to lead this release. I'll support you. Lately, I've lacked energy for open source, but I'm changing that. This weekend, I'll start a PR for Ruby 3.3 support.

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