Somesh
Somesh

Reputation:

Routes.rb creating problem in rails

Im using a link which is

: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.

Upvotes: 0

Views: 269

Answers (1)

serioys sam
serioys sam

Reputation: 2051

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

Upvotes: 3

Related Questions