First off... I love keeping things organized. As such, it's starting to bother me that the list of controllers in my app just keeps growing in one large directory.
Ideally, I could construct a list of subdirectories and organize my controllers. You can do this with namespaces, but then the subdirectory shows up within the url, and I really don't want this to happen.
Does anyone have a different strategy to keep their controllers, helpers, models, and views organized?
Ideally, I could construct a list of subdirectories and organize my controllers. You can do this with namespaces, but then the subdirectory shows up within the url, and I really don't want this to happen.
You can scope
the routes against a specific namespace. Read Controller Namespaces and Routing
scope module: 'admin' do
resources :posts, :comments
end
Will generate routes at /posts
while the controller is at Admin::PostsController
found in app/controllers/admin/posts_controller.rb
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With