For example, when I go to users/invitations/new
, the only field is :email
. I'd like to invite a user and, in addition to providing their email, provide:
- first_name
- last_name
- role
- company (
user belongs_to company
)
I created Users::InvitationsController < Devise::InvitationsController
:
class Users::InvitationsController < Devise::InvitationsController
private
def resource_params
params.permit(user: [:email, :invitation_token, :role, :company_id])[:user]
end
end
and I added those fields to users/invitations/new
. The invitation sends fine, but when I accept it and input a password, my validation fails saying that No role is selected
(b/c of a validation).
How can I set these fields before sending the invite and have them persist and save when the invite is accepted? Thanks!