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

Railtie deprecation warning 'Initialization autoloaded the constant MagicLinks::UrlHelper' #10

Closed
wozza35 opened this issue Jul 5, 2022 · 0 comments · Fixed by #11
Closed

Comments

@wozza35
Copy link
Collaborator

wozza35 commented Jul 5, 2022

The railtie is including the UrlHelper inside an 'action controller loaded' hook.

Initialization is a one-off process. Because the files in an engine are automatically added to Rails' autoload paths, the UrlHelper is marked for hot reloading. As the initialization only happens once, we shouldn't be including the helper in an initializer like we do currently. Any changes to the helper will not update the code in ActionController.

Wrapping the inclusion of the helper in a to_prepare block will ensure the railtie codeis rerun after a hotreload. This will prevent any potentially issues during development and remove the deprecation warning.

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 a pull request may close this issue.

1 participant