Here is how I have done it.

In routes:

map.namespace(:admin) do |admin|
    admin.resources :users, :member=>{:edit_password=>:get,
                                           :update_password=>:post }
    admin.resources :suppliers
    admin.resources :categories
end

Now just use admin in the path methods
eg.
    = link_to 'Edit', edit_admin_user_path(@user)
    = link_to 'Password', edit_password_admin_user_path(@user)
    = link_to 'Back', admin_users_path

In the form:
form_for [:admin,@user] do |f|

But have a look at the routing section on the railsguides site.  There
are quite a few options for setting up routes and I still have to play
with some of them myself.

I am actually planning to eliminate the need for admin in my path
methods by using  :name_prefix=>nil in the route.  I think I did this
somewhere once when I needed to move a resource into the admin
namespace.  It simplifies the process since the paths don't need to be
edited.  But then admin wont appear or be required in the url.

Tonypm

--~--~---------~--~----~------------~-------~--~----~
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-talk@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to