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
[WIP] Rails7 #22873
Open
jrafanie
wants to merge
11
commits into
ManageIQ:master
Choose a base branch
from
jrafanie:rails7
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[WIP] Rails7 #22873
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jrafanie
requested review from
agrare,
kbrock,
jeffibm and
Fryguy
as code owners
February 1, 2024 22:48
jrafanie
force-pushed
the
rails7
branch
4 times, most recently
from
February 5, 2024 22:59
a495d2d
to
59d87c0
Compare
This was referenced Feb 7, 2024
jrafanie
force-pushed
the
rails7
branch
4 times, most recently
from
February 9, 2024 19:18
322ef1c
to
803369e
Compare
jrafanie
force-pushed
the
rails7
branch
2 times, most recently
from
March 4, 2024 23:12
e698c96
to
64016c0
Compare
This pull request is not mergeable. Please rebase and repush. |
Rails 7 autoloading during boot doesn't use autoload_paths so you must use either to_prepare hooks, after_initialize, on_load hooks for frameworks, or by avoiding autoload entirely by manually requiring files needed to be loaded during rails boot. See also: https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots "While booting, applications can autoload from the autoload once paths, which are managed by the once autoloader. Please check the section config.autoload_once_paths above. However, you cannot autoload from the autoload paths, which are managed by the main autoloader. This applies to code in config/initializers as well as application or engines initializers. Why? Initializers only run once, when the application boots. If you reboot the server, they run again in a new process, but reloading does not reboot the server, and initializers don't run again."
See rails commit: e3b9779cb701c63012bc1af007c71dc5a888d35a Very similar to the change found in: https://github.com/ManageIQ/activerecord-virtual_attributes/pull/133/files
Fixes the following deprecation warnings: DEPRECATION WARNING: Time#to_s(:db) is deprecated. Please use Time#to_fs(:db) instead. (called from block (2 levels) in add_metric_rollups_for at /Users/joerafaniello/Code/manageiq/spec/support/chargeback_helper.rb:43) DEPRECATION WARNING: Integer#to_s(:human_size) is deprecated. Please use Integer#to_fs(:human_size) instead. (called from block in build_disk_message at /Users/joerafaniello/Code/manageiq/app/models/vm_reconfigure_task.rb:43) DEPRECATION WARNING: Integer#to_s(:human_size) is deprecated. Please use Integer#to_fs(:human_size) instead. (called from block (3 levels) in <main> at /Users/joerafaniello/Code/manageiq/spec/models/vm_reconfigure_task_spec.rb:45) DEPRECATION WARNING: Integer#to_s(:human_size) is deprecated. Please use Integer#to_fs(:human_size) instead. (called from block (3 levels) in <main> at /Users/joerafaniello/Code/manageiq/spec/models/vm_reconfigure_task_spec.rb:58) DEPRECATION WARNING: Integer#to_s(:human_size) is deprecated. Please use Integer#to_fs(:human_size) instead. (called from block (3 levels) in <main> at /Users/joerafaniello/Code/manageiq/spec/models/vm_reconfigure_task_spec.rb:59)
Fixes the warning: DEPRECATION WARNING: ActiveSupport::TimeWithZone.name has been deprecated and from Rails 7.1 will use the default Ruby implementation. You can set `config.active_support.remove_deprecated_time_with_zone_name = true` to enable the new behavior now. (called from block in ruby_object_usage at /Users/joerafaniello/Code/manageiq/app/models/miq_worker/runner.rb:435)
We were using a private class variable. There's a public interface we can use and avoid a deprecation by switching from the variable to subclasses: ActiveSupport::DescendantsTracker.direct_descendants is deprecated and will be removed in Rails 7.1. Use ActiveSupport::DescendantsTracker.subclasses instead.
We're now eager loading subclasses when loading the parent but this is far less reliant on hacks and closer to full eager loading, which is what rails has been pushing us to do for years. Let's try it out. Rails changed in 7.0 to call subclasses from reload_schema_from_cache here: rails/rails@6f30cc0 It also changed to call descendants on the callback class (self) insead of the ActiveSupport::DescendantsTracker here: rails/rails@ffae3bd We are not expecting to be called from these locations. Avoiding descendants / subclasses calls in conditionals like this are just brittle so we need to stop hooking through these methods: if !%w[reload_schema_from_cache __update_callbacks descendants subclasses].include?(caller_locations.first.base_label)
This reverts commit c68bf232bacb31804c073e3e1ae69cfcdaf14462.
Checked commits jrafanie/manageiq@e835787~...807bb6d with ruby 2.7.8, rubocop 1.56.3, haml-lint 0.51.0, and yamllint app/models/vm_reconfigure_task.rb
lib/manageiq/session.rb
lib/miq_preloader.rb
spec/lib/extensions/ar_to_model_hash_spec.rb
spec/models/vm_reconfigure_task_spec.rb
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #22052