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

Fix routes command for Rails 7.1+ #13

Merged

Conversation

dtflowers
Copy link
Contributor

Description
Attempt to fix #12

This commit to Rails broke the monkey-patch in this gem that previously forced the eager_loading of routes when the Routes command is run in console.

Specifically, the require_environment! wrapper method on lines 26-29 here was removed entirely, which means the existing monkey-patch in lib/routes_lazy_routes/command/routes_command.rb is never executed.

Instead, the application level Rails.application.require_environment! method is now called directly here when this command is run.

This PR refactors the monkey patch to instead patch the application level Rails.application.require_environment! method directly, prepending the patch to force eager loading only when the routes command is run.

@amatsuda
Copy link
Owner

@dtflowers This patch looks perfect indeed! Thank you so much!

@amatsuda amatsuda merged commit 68f1dc3 into amatsuda:master Jan 23, 2024
0 of 20 checks passed
@amatsuda
Copy link
Owner

@dtflowers @r7kamura Just release version 0.4.3 gem with this patch. Thanks!

@dtflowers dtflowers deleted the fix-routes-command-for-rails-7.1 branch January 24, 2024 05:00
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.

Routes Command broken as of Rails 7.1+
2 participants