map.resources for controllers in a module

Hello-

I'm giving RESTful development a shot. I'm running into some difficulty with controller I have grouped into modules. Specifically, I have a "admin" module with a "user" controller (created with "generate controller admin/user"). I managed to get map.resources wired up with this code:

map.resources Admin::User, :path_prefix => "/admin"

I'm not sure if that's the right way, but it seems to work. The problem I'm running into is with setting up my link_tos. I tried this code:

<%= link_to 'Show', user_path(@user) %>

Which failed with a "undefined method `user_path' for #<#<Class:0x47eaa14>:0x47ea9ec>". Not unexpected. However I can't figure out the right syntax for the path to my user admin actions. Can anyone help?

Regards- Eric

Look at namespace   map.namespace :admin do |admin|     admin.resources :users   end gives you helpers such as this: <%= link_to 'Show', admin_user_path(@user) %> also look at the very useful:

rake routes

Eric Marthinsen wrote:

map.namespace :admin do map.resources :users end

admin_user_path(@user)

should do the trick.

Hi,    Here is a perfect 2.0 RESTful nested and namespace tutorial, after checking u would totally understand the whole stuff. I am not doing ad here. cuz it really needs to recommend :slight_smile:

This is great info. Exactly what I waslooking for. Thanks.

Regards-      Eric