Namespace with index action in Rails

Posted by yuval on Stack Overflow See other posts from Stack Overflow or by yuval
Published on 2010-03-15T23:17:46Z Indexed on 2010/03/15 23:19 UTC
Read the original article Hit count: 196

Filed under:
|
|

I have an admin controller located inside /controllers/admin/admin_controller.rb I also have a pages controller located inside /controllers/admin/pages_controller.rb In my routes.rb file, I have the following:

  map.namespace :admin do |admin|
    admin.resources :pages
  end

When the user goes to localhost:3000/admin, I'd like the user to see a page with a link to /admin/pages (Pages CRUD) and to / (To go back home). Since I am using a namespace, I cannot have an index action for /admin. How would I get this done and still have my controllers located inside my /controllers/admin folder (rather than using admin as a map.resources component and a has_many association to pages). Please note I am only interested in the show action of admin.

Thank you!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about namespaces