How does one do namespaced controllers in Merb, for instance to create an admin section to the site? In Rails one would use Admin::CategoriesController, is this similar in Merb or is this another recommended way of doing it?
+2
A:
The namespace method seems to do it.
This is placed in the routes file (router.rb):
namespace :admin do
resources :categories
end
This generates routes like:
edit_admin_category - /admin/categories/:id/edit(.:format) delete_admin_category - /admin/categories/:id/delete(.:format) admin_categories - /admin/categories(/index)(.:format) new_admin_category - /admin/categories/new(.:format) admin_category - /admin/categories/:id(.:format)
I then put my controller in a module like this:
module Admin
class Categories < Application
def index
...
end
.
.
.
end
end
I am not sure if this is the recommended way, any suggestions to this would be great.
Laz
2008-11-12 06:49:26