Fix compatibility with rails 9#75
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the engine controllers to be compatible with Rails 9 by removing require_dependency calls that are slated for removal, relying on Rails/ Zeitwerk autoloading instead.
Changes:
- Removed
require_dependency "audits1984/application_controller"from engine controllers. - Kept controller inheritance and module structure unchanged to preserve existing behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/controllers/audits1984/sessions_controller.rb | Removes require_dependency for Rails 9 compatibility. |
| app/controllers/audits1984/filtered_sessions_controller.rb | Removes require_dependency for Rails 9 compatibility. |
| app/controllers/audits1984/audits_controller.rb | Removes require_dependency for Rails 9 compatibility. |
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| foreign_key: :auditor_id, | ||
| dependent: :delete | ||
| initializer "audits1984.auditor_token_association" do | ||
| Rails.autoloaders.main.on_load(Audits1984.auditor_class) do |klass, _abspath| |
There was a problem hiding this comment.
The Rails.autoloaders.main.on_load method expects a class constant, not a string. Since Audits1984.auditor_class is a string (e.g., "::User"), this will fail at runtime. The string needs to be converted to a constant using .constantize before being passed to on_load.
| Rails.autoloaders.main.on_load(Audits1984.auditor_class) do |klass, _abspath| | |
| Rails.autoloaders.main.on_load(Audits1984.auditor_class.constantize) do |klass, _abspath| |
require_dependency will be removed in rails 9