I am sending an invitation to a new user using Devise Invitable. I have a related table to Users called Organizations, with a belongs_to/has_many relationship. When the new user goes to accept the invitation, it states that there must be an organization specified. How would I go about making sure the user is assigned to the inviting user's organization automatically, so that the database is updated and the invitation can be accepted?
Thank you!
Modeling after the invitation token as a hidden field, I added
<%= f.hidden_field :plan_id, :value => 1 %>
<%= f.hidden_field :organization_id, :value => 1 %>
to the edit.html.erb invitations view. This works to submit the information I'm looking for, but I'm worried that it is not secure, as those parameters could be adjusted. I also tried adding the following to the edit control in the invitations controller, but it did nothing.
resource.plan_id = 1
resource.organization_id = 1