Hi,
In my app/views/admin/clieint/_searchresults.rhtml partial, I have …
<% for user in @users %>
<%=h user.ship_to_first_name %> <%=h user.ship_to_last_name %> <%=h user.email %> <%= link_to 'Show', {:action => 'show', :id => user.id} %> <% 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 –
ActionView::Helpers::UrlHelper.
Is it related to the “namespace” directive in my config;routes.rb
file?
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 =>
‘destroy’
map.change_password ‘/change_password’, :controller =>
‘user’, :action => ‘change_password’
map.namespace :admin do |adm|
adm.resources :client, :collection => { :search
=> :get, :searchresults => :get }
end
The priority is based upon order of creation: first created →
highest priority.
Sample of regular route:
map.connect ‘products/:id’, :controller => ‘catalog’, :action =>
‘view’
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 => product.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’