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.