views:

195

answers:

1

Hi Im using a link which is <%= link_to 'View User Group', {:controller=>:communities,:action=>:usergroups} , :class => "adminbutton viewusergrp" %>

and routes contain the map.resources :vccommunities,:member => {:usergroups => :get} and some more action names are also specified here in member and collection. Im taking care of alphabetical order while listing these actions within :member

But while clicking on that link ...it is taking :action => show, :id => usergroups, :controller => :communities

so it is thowing error ,since it is not going to the proper action in the controller.

Please help me in that.

+3  A: 

the problem is not with your route problem is with your link. as per the defination of routes rails internally searches for id in link hash in your eg link like this

<%= link_to 'View User Group', {:controller=>:communities,:action=>:usergroups, :id => 20} , :class => "adminbutton viewusergrp" %>
should work cause this will map to

/communities/20/usergroups

for further refrence can be taken from this page

serioys sam
Thnx alot...This worked out......