link_to weirdness, related to namespace?


In my app/views/admin/clieint/_searchresults.rhtml partial, I have ...

<% for user in @users %>
    <td><%=h user.ship_to_first_name %></td>
    <td><%=h user.ship_to_last_name %></td>
    <td><%=h %></td>
    <td align="center"><%= link_to 'Show', {:action => 'show', :id =>} %></td>
<% end %>

but when the link is output to the browser, it is output as "/admin/
client/2", notice that the id is there, but the action, "show" is
not. Why is link_to not outputting correctly? I'm following the
instructions from here --
Is it related to the "namespace" directive in my config;routes.rb

Thanks, - Dave

================begin config/routes.rb file =======================
ActionController::Routing::Routes.draw do |map|

  map.connect '', :controller => "register", :action => "start"

  map.resources :users
  map.resources :sessions
  map.signup '/signup', :controller => 'users', :action => 'new'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.logout '/logout', :controller => 'sessions', :action =>
  map.change_password '/change_password', :controller =>
'user', :action => 'change_password'

  map.namespace :admin do |adm|
    adm.resources :client, :collection => { :search
=> :get, :searchresults => :get }

  # The priority is based upon order of creation: first created ->
highest priority.

  # Sample of regular route:
  # map.connect 'products/:id', :controller => 'catalog', :action =>
  # Keep in mind you can assign values other than :controller
and :action

  # Sample of named route:
  # map.purchase 'products/:id/purchase', :controller =>
'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id =>

  # You can have the root of your site routed by hooking up ''
  # -- just remember to delete public/index.html.
  # map.connect '', :controller => "welcome"

  # Allow downloading Web Service WSDL as a file with an extension
  # instead of a file named 'wsdl'
  map.connect ':controller/service.wsdl', :action => 'wsdl'

  # Install the default route as the lowest priority.
  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'
====================end config/routes.rb file

I'd suggest removal of every route you don't need, at least last three
ones, but your problem is not there.
In fact, there is no problem - link_to creates exactly what you need -
GET /admin/client/2 will be routed to Admin::ClientsController#show,
as you would expect.
Read more on all that restful stuff.