Repository navigation
Bring back feature that allows loading external route files: - #37892
rafaelfranca merged 1 commit into
Conversation
eb1fead to
0641a56
Compare
|
@dhh mind to review the documentation to see if it talk about the trade-offs you want to be clear? |
dhh
left a comment
There was a problem hiding this comment.
Besides this small nit, this is solid. Good to go!
There was a problem hiding this comment.
I'd say the cut-off is thousands. We have 500+ at Basecamp, and the split is def not worth it there.
There was a problem hiding this comment.
We are including different routes on boot, based on some environment variables (like hostname), so for us it's not the total size, but the general separation of different customer routes which is important for us. So there are other factors too to consider, not only the size :)
2d32687 to
e47d9ec
Compare
|
Thanks for the quick review. This should be good to go |
= This feature existed back in 2012 rails@5e7d6bb but got reverted with the incentive that there was a better approach. After discussions, we agreed that it's a useful feature for apps that have a really large set of routes. Co-authored-by: Yehuda Katz <wycats@gmail.com>
e47d9ec to
33bf253
Compare
This reverts commit 6acebb3. Usage of this feature did not reveal any improvement in existing apps. Conflicts: actionpack/lib/action_dispatch/routing/mapper.rb guides/source/routing.textile railties/lib/rails/engine.rb railties/lib/rails/paths.rb railties/test/paths_test.rb
|
Could you maybe add a test which checks if a route concern works, if it's included in a previously loaded concern? Like: # config/routes.rb
Rails.application.routes.draw do
draw(:admin)
draw(:custom1)
draw(:custom2)
end
# config/routes/custom1.rb
namespace :custom1 do
concerns :admin
end
# config/routes/custom2.rb
namespace :custom2 do
concerns :admin
end
# config/routes/admin.rb
concern :admin do
resources :tests
endI'm not sure, but i tried multiple splitting options in the last years, and many of them had a problem with concerns. |
|
It should work. You could try and report back if it doesn't but this mechanism is the same as defining those concerns in the same file. |
Rails 6.1から標準でroutesファイルを分割できるようになったため。 rails/rails#37892
|
Thank you so much for re-implementing this! Our application has a very trim, optimized, 1,054-line routes file that I want to split up very badly! Hopefully we can get on Rails 6.1 soon. |
Bring back feature that allows loading external route files:
This feature existed back in 2012
5e7d6bb
but got reverted with the incentive that there was a better approach.
After discussions, we agreed that it's a useful feature for apps
that have a really large set of routes.
Co-authored-by: Yehuda Katz wycats@gmail.com
cc/ @rafaelfranca @etiennebarrie @casperisfine