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

Rails 7.1 support #1371

Merged
merged 6 commits into from
Oct 16, 2023
Merged

Conversation

lsylvester
Copy link
Contributor

Updates to support Rails 7.1.0 which is now in beta:

  • Add Gemfile for 7.0 as edge is now 7.1
  • Avoid use of the ActiveSupport::Deprecation singleton (which is deprecated). Use a dedicated instance of ActiveSupport::Deprecation instead.
  • Replace ActiveSupport::SafeBuffer with ActionView::OutputBuffer as ActiveSupport::SafeBuffer no longer has a concat method. ActionView::OutputBuffer is not a string, so it is required to explicitly cast it to a string in places. The content of the ActionView::OutputBuffer could not be replaced, so new instances were created instead.
  • Remove silencing of deprecation for column_for_attribute - which was related to upgrading to Rails 5 and is no longer required.

@tomascco
Copy link

@lsylvester I'm not a maintainer or anything, but I think you could also update the CI at .github/workflows/test.yml to run with Rails 7.0 and 7.1.

For this I think you also need to run bundle update at the root of the gem to update the current Gemfile.lock to the Rails 7.1.

Copy link

@davidwessman davidwessman left a comment

Choose a reason for hiding this comment

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

Looked through all the changes and it looks great, did you try to run the tests on Rails 6.0 as well?

@lsylvester
Copy link
Contributor Author

did you try to run the tests on Rails 6.0 as well?

Test the tests have run against all the Gemfiles.

I'm not a maintainer or anything, but I think you could also update the CI at .github/workflows/test.yml to run with Rails 7.0 and 7.1.

Good catch. I have updated the test.yml to include the Rails 7.0 and Rails 7.1 gemfiles (I also added a Rails 7.1 gemfile as it has been released since the PR was originally made). I also had to relax the version of rspec-mocks to get a fix for rspec/rspec-mocks#1514

@javierjulio
Copy link

@lsylvester I'm not a maintainer. I've asked someone who is and they've approved CI so you should be able to review and address test failures. Thank you for doing this!

@lsylvester
Copy link
Contributor Author

CI was failing due to script/integration.sh script, and I had only verified the that rspec spec ran.

The issue is that password is not an expected type, which now raises an error since rails/rails#42311. I have made a change to not pass in the attribute type which should make it pass, and the generator doesn't seem to use the type so I think this should be sufficient.

@lsylvester
Copy link
Contributor Author

Latest CI run failed due to

Fetching https://github.com/rack/rack.git
fatal: Needed a single revision
Git error: command `git rev-parse --verify master` in directory
/home/runner/work/formtastic/formtastic/vendor/bundle/ruby/3.0.0/cache/bundler/git/rack-a69799d848c55dca271cda2858f0ae7d1dd533b8
has failed.
Revision master does not exist in the repository
https://github.com/rack/rack.git. Maybe you misspelled it?

I am not sure why this was working on the ruby 2.7.2 run - but this has been fixed by using the main branch for rack.

@deivid-rodriguez
Copy link
Member

Hei! Sorry for not attending this earlier.

I think that failure you got also exists in the current master branch. The problem is that ruby/setup-ruby uses whatever Bundler version that comes installed by default with each Ruby in absence of a lockfile. And Bundler version installed with Ruby 3.0 didn't handle git gems fine when their default branch was not named "master".

Your fix works too, but I'd rather go with using the latest Bundler everywhere to hopefully avoid similar issues in the future, so I proposed that separately to get a green baseline here: #1373.

ActiveSupport::SafeBuffer no longer has the capture method. ActionView::OutputBuffer cannot have the contents replaced, so a new instance was assigned in placed where this was occuring, and they need to explictily converted to strings.
…s 5 as those warnings no longer occur in supported versions
…ed attribute type and will raise error since Rails 7
Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

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

This looks great to me!

I would remove the latest commit since it should no longer be necessary after #1373. I don't think it will cause any harm either since I bet these gems are not going to rename their default branch again, but still. Anyways, non blocking!

@deivid-rodriguez
Copy link
Member

Thanks @lsylvester, merging this!

@mikz @justinfrench Any chance we can get a release out with Rails 7.1 support?

@deivid-rodriguez deivid-rodriguez merged commit 2561655 into formtastic:master Oct 16, 2023
13 checks passed
@lsylvester
Copy link
Contributor Author

Thanks @deivid-rodriguez. I really appreciate your help with this.

@justinfrench
Copy link
Member

Thanks @lsylvester @deivid-rodriguez

I've shipped a new 5.0.0 gem release

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

6 participants