I have this nested route:
map.resource :users do |user|
user.resources :roles
end
Which, among others, gives me this named routing, user_roles:
user_roles GET /users/:user_id/roles
(.:format)
{:controller=>"roles",
:action=>"index"}
However, when I try using "link_to to user_roles" I get this method
missing error. What am I doing wrong?
NameError in Users#show
Showing app/views/users/show.html.erb where line #59 raised:
undefined local variable or method `user_roles'' for
#<ActionView::Base:
0x2aaaac0c3bf0>
Extracted source (around line #59):
57:
58: <%= link_to ''View This Account\''s Assigned
Roles'',
59: user_roles,
60: :id => ''user_roles_link''%>
61:
On Nov 12, 2:22 pm, byrnejb <byrn...-fqAF1SpE7daWxEb2tNKyrg@public.gmane.org> wrote:> > However, when I try using "link_to to user_roles" I get this method > missing error. What am I doing wrong? > > NameError in Users#show > > Showing app/views/users/show.html.erb where line #59 raised: > > undefined local variable or method `user_roles'' for #<ActionView::Base: > 0x2aaaac0c3bf0> > > Extracted source (around line #59): > > 57: > 58: <%= link_to ''View This Account\''s Assigned Roles'', > 59: user_roles, > 60: :id => ''user_roles_link''%> > 61:Should be instead: 57: 58: <%= link_to ''View This Account\''s Assigned Roles'', 59: user_roles_path, 60: :id => ''user_roles_link''%> 61: Sigh...