-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add Rails 7 Support #7235
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 #7235
Conversation
3d78c26
to
7253b1f
Compare
Updates:
|
7253b1f
to
d786a97
Compare
🟢 Specs are green!I've got the reason of the failure (and - of course - it was pretty simple) Rails 7's default
So Rails 7 is going to perform eager loading and it fails, because I'm not sure of the fix (disable eager loading), please let me know what do you think |
6791aa9
to
9469604
Compare
UPDATERansack 2.5.0 released, four to go:
Cucumber Rails may need help, there are two conditional test cases to write --> cucumber/cucumber-rails#523 |
48fc4ee
to
12ef798
Compare
UPDATE 2021-12-30There is an issue with Rails 7, code reloading, dev environment, and the new It is described here: #7196 (comment) It can be replicated in dev environment by changing something in an activeadmin file ( Changing Ref: rails/rails@0547b16 UPDATE 2021-12-31The problem is an incompatibility with the new Server-Timing feature Server-Timing subscribes to all notifications, and it creates an event by using rails/rails@0547b16#diff-7bae50494146f858329a92e06ec56eb449abff287fc6de733b99b11c589b6c3aR16 I do not know how to fix this |
12ef798
to
93b4a3e
Compare
93b4a3e
to
8ccc35b
Compare
8ccc35b
to
3ff80bb
Compare
Hi @alejandroperea, thanks! I was hoping for #7275 to be merged before rebasing, so I can clean up other things and remove unrelated changes and gem updates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! 🎉
@tagliala cucumber-rails 2.5.0 has been released. I created #7369 to upgrade master and tagliala#7 to upgrade this PR in case 7369 reaches master first. |
@mgrunberg thanks I can rebase if #7369 is going to be merged before this one |
I don't have a preference either way, I'll let @javierjulio choose when he gets to this :) |
@tagliala Thank you for your efforts getting this updated! |
- Relax railties dependency to allow 7.0 - Move Rails 6.1 Gemfile to gemfiles directory - Set main test application to Rails 7.0
This method has been removed in Rails 7 and replaced with `constantize`
`ActiveAdmin::Aplication.remove_active_admin_load_paths_from_rails_autoload_and_eager_load` is not working on feature tests. Starting from Rails 7.0, running tests with eager_load enabled produces the following error: ``` Failure/Error: require "#{ActiveAdmin::TestApplication.new.full_app_dir}/config/environment.rb" FrozenError: can't modify frozen Array: ["<root>/tmp/test_apps/rails_70/app/admin", "<root>/tmp/test_apps/rails_70/app/channels", "<root>/tmp/test_apps/rails_70/app/controllers", "<root>/tmp/test_apps/rails_70/app/controllers/concerns", "<root>/tmp/test_apps/rails_70/app/helpers", "<root>/tmp/test_apps/rails_70/app/jobs", "<root>/tmp/test_apps/rails_70/app/mailers", "<root>/tmp/test_apps/rails_70/app/models", "<root>/tmp/test_apps/rails_70/app/models/concerns", "<root>/tmp/test_apps/rails_70/app/policies" ``` `ActiveAdmin::Aplication.remove_active_admin_load_paths_from_rails_autoload_and_eager_load` fails because `ActiveAdmin.application.load_paths` value is `<root>/app/admin` when it should be `<root>/tmp/test_apps/rails_70/app/admin`. `ActiveAdmin::ApplicationSettings` initialize `load_path` with `[File.expand_path("app/admin", Rails.root)]`. On testing app bootstrap ([this line](https://github.com/activeadmin/activeadmin/blob/master/features/support/env.rb#L12)) `Rails.root` is nil and `File.expand_path` is expanding to the folder where `rake test` runs (`<root>`). `ActiveAdmin::Engine` has an initializer to define default value for `load_paths`. The problem is that the block runs after initializers in `config/initializers` folder, including `ActiveAdmin.setup` where `ActiveAdmin::Aplication.remove_active_admin_load_paths_from_rails_autoload_and_eager_load` is called from. This commit makes sure the block runs before `config/initializers`. That way the block sets a proper default.
At the moment of this commit, JRuby does not support Ruby 2.7, the minimum version required to run Rails 7.0, and gems did not install with jruby-head This platform can be added back when JRuby will release a version compatible with 2.7 MRI
3299528
to
73ce06e
Compare
Got a segmentation fault on 2.7 vs 6.1. Any chance to restart the build? :\ |
Yes I will, thanks for checking it as I was about to ask whether we needed a rebuild or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @tagliala! 🙌🏻❤️
Thanks so much @tagliala and @mgrunberg!! |
Fantastic Work 🥳 |
This is awesome. Thank you very much |
I've updated to Rails 7 but am getting crashes with uninitialized model constants on the first line of our Admin declarations. Using version 2.11.1, just wondering if you had any hints to debug? Not doing anything fancy with loading as far as I can see, but zeitwerk seems unhappy... |
Were you using Have you checked this?
You might want to review the Classic to Zeitwerk HOWTO Anecdotally, I've finished upgrading my app (using ActiveAdmin) to Rails 7 recently, using this update, and it went smoothly. No issues, and no additional AA changes required, it just worked. |
Thanks for adding support for rails 7! Is it possible to release a version for this PR ? |
Hi @yosiat , Rails 7 support has been released in v2.11.0 Changelog: https://github.com/activeadmin/activeadmin/releases/tag/v2.11.0 |
@tagliala sorry, my mistake! |
Hi, this is a work in progress and I'm opening this PR as a reference to #7196
I'm trying to update activeadmin to use Rails 7, but there are some blocking dependencies:
✅ No known issues
instrument
from the Notifications API instead of low levelpublish
#7262before_action
option is enabled: Support Rails 7 #7196 (comment) Add Rails 7 Support #7235 (comment) Remove deprecation warning using controller filters inside initializer #7340✅ Dependencies checklist
✅ Removed dependencies
At the moment, there are no stable JRuby versions supporting MRI 2.7, the minimum required version to run Rails 7.0. There was too much effort in trying to build against jruby-head, so JRuby dependency has been temporarily removed
Test in your application
1. Changes to Gemfile
Add the following to your Gemfile:
Tests
uninitialized constant #<Class:Cucumber::Rails::Database>::NullStrategy (NameError)
. It is worth to mention that cucumber-rails does seem to work with Rails 7, or at least it does not have specs covering this issue. Ref: Support for Rails 7 cucumber/cucumber-rails#523 (comment)