link_to を使用して、必要な手順を実行するために 2 つのパラメーターを必要とするコントローラー メソッドを開始しています。構文を正しく理解できないようですが、この特定の構文を使用して複数のパラメーターを渡すことができないためではないかと考えています。これが私がこれまでに持っているものです:
<%= link_to 'Select',
{controller: 'groups',
action: 'associate_subgroup_with_org',
organization_id: organization.id,
subgroup_id: @activity.group.id},
class: 'button' %>
def associate_subgroup_with_org
@organization = Group.find(params[:organization_id])
@subgroup = Group.find(params[:subgroup_id])
@subgroup.parent_group_id = @organization.id
respond_to do |format|
format.js
end
end
リンクが機能せず、コントローラーのアクションを入力しませんassociate_subgroup_with_org
。誰かが構文を正しくするのを手伝ってくれますか?