Admin Controllers in Merb
2 answers
The namespace method seems to do this.
This is put into the routes file (router.rb):
namespace :admin do
resources :categories
end
This creates 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)
Then I install my controller into a module like this:
module Admin
class Categories < Application
def index
...
end
.
.
.
end
end
I'm not sure if this is the recommended way, any suggestions on this would be great.
+2
source to share