1

I would like allow users to create groups and invite other users to their group. Currently, I have users and groups connected through has_many :through relationship (where Membership is the class that connects User and Group classes).

I am allowing the owner of the group to go to the "show" page for a group and create memberships by selecting users to invite (through a form). When I do this, I want to pass not only the ids of the users he selected but also the id of the group whose "show" page he is on.

What is the best way to accomplish this task? Currently, I am including a hidden tag in the form that includes the value @group.id. However, I imagine that there must be a better way to do this.

4

1 回答 1

0

只需将它包含在表单提交到的路由中,就像显示页面发送 params[:id] 一样。

于 2013-07-28T21:03:41.270 回答