On Wed, Mar 17, 2010 at 3:14 PM, Stefan Buhr <li...@ruby-forum.com> wrote:
> Hi there, > > I'm stuck with some very simple routing requirements. Somehow I believe > this is not even possible with the new Rails 3 Router: > > So i have my Admin::SettingsController class in controllers/admin > > My intention is to access the admin-controllers via > /admin/:controller/:action > > in my routes.rb I add: > namespace :admin do > match ':controller(/:action(/:id))' > end (I want the admin part of my application to be unRESTful) > > However, now EVERY controller is accessable via > /admin/controller/action!... For example, url_for :controller => > 'books', :action => 'show' generates "/admin/books/show" ... likewise, > url_for :controller => 'admin/settings', :action => 'group' now > generates "/admin/admin/settings/group" (should be: > "/admin/settings/group". > > How can I get SIMPLE namespace'd controllers to work in rails without > affecting other controllers? Does anyone know? > > Thank you :) > Stefan, in Rails 3, you can do the following in your routes.rb: namespace :admin do resources :settings end Then, you'll end up with the following controllers: /admin/settings Good luck, -Conrad > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com<rubyonrails-talk%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.