Sunday 15 September 2013

ruby on rails - How do I pass more than one parameter into a link_to call where I specify controller and action? -


I am using link_to to start a controller method for which two parameters are required so that I I can follow the steps required to take. I do not think the syntax is correct, and I am thinking that this is because you can not pass more than one parameter in using this special syntax. Even I have so far:

  & lt;% = link_to 'select', {controller: 'group', verb: 'associate_subgroup_with_org', organization_id: organization.id, Subgroup_id: @activity.group.id}, Class: 'Button'% & gt; Def associate_subgroup_with_org @Orgroup = group.fund (Params [: organization_id]) @subgroup = Group.find (params [: subgroup_id]) @abagraph. Parent_group_id = @ organization.id response_to do | Format | The formatting.js end end   

link is not working and I do not enter my controller action associate_subgroup_with_org . Can anyone help me correct the syntax?

You can create a path like this: Get '/ Group / collaborative_subgroup_v_a_or' = & gt; 'Groups # Associate_SubGroup_ViOrd' ,:As = & gt; : Associate_subgroup

And you can not send any one. Link_to:

  & lt;% = link_to 'Select', {Controller: 'Group', Action: 'associate_subgroup_with_org', organization_id: organization.id, subgroup_id: @greative.group parameters Of Id}, class: 'button'% & gt;   

or,

  & lt;% = link_to 'select', associate_subgroup_path (organization_id: organization.id, subgroup_id: @type.gov.edg) , Category: 'Button'% & gt;    

No comments:

Post a Comment