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

Make Active Storage routes optional #36666

Merged

Conversation

gmcgibbon
Copy link
Member

Summary

Currently, I don't see a way of turning off Active Storage's default routes. They are drawn on the host application and not on the engine (due to direct and resolve being used). For applications that only want to use assets internally, or need to point to different controllers to meet their app's needs, the only way to remove routes currently is something like this:

initializer(:remove_activestorage_routes, after: :add_routing_paths) do |app|
  app.routes_reloader.paths.delete_if { |path| path =~ /activestorage/ }
end

Does it make sense to make this easier? cc @georgeclaghorn

@gmcgibbon gmcgibbon force-pushed the allow_disabling_active_storage_routes branch 2 times, most recently from ba575ad to a6bb69b Compare July 15, 2019 15:36
@gmcgibbon gmcgibbon force-pushed the allow_disabling_active_storage_routes branch from a6bb69b to 44f951a Compare July 17, 2019 18:39
@rails-bot rails-bot bot added the docs label Jul 17, 2019
@gmcgibbon
Copy link
Member Author

gmcgibbon commented Jul 17, 2019

Looks like CI is complaining about my development config bleeding into other tests. I'll see if I can fix that

The default value was nil so routes weren't being drawn by default. 🤦‍♂

@gmcgibbon gmcgibbon force-pushed the allow_disabling_active_storage_routes branch from 44f951a to ec55d4e Compare July 19, 2019 18:33
Add configuration option to turn off drawing of Active Storage routes.
@gmcgibbon gmcgibbon force-pushed the allow_disabling_active_storage_routes branch from ec55d4e to 3cf65bc Compare July 22, 2019 16:35
@gmcgibbon gmcgibbon merged commit 2ee7597 into rails:master Jul 22, 2019
@gmcgibbon gmcgibbon deleted the allow_disabling_active_storage_routes branch July 22, 2019 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants