ruby on rails - Devise_invitable app/views/devise/invitation.html.erb 'registration' fields RoR -


i'm sure there people out there have done this. started down it, made app crash few times, figured i'd ask out there rather continue driving webapp in oblivion. i'm using devise_invitable gem. sends link invited users, click link, , they're directed view @ app/views/devise/invitation.html.erb:

<h2><%= t 'devise.invitations.edit.header' %></h2>  <%= simple_form_for resource, as: resource_name, url: invitation_path(resource_name), html: { method: :put } |f| %> <%= devise_error_messages! %> <%= f.hidden_field :invitation_token %>  <%= f.input :password %> <%= f.input :password_confirmation %>  <%= f.button :submit, t("devise.invitations.edit.submit_button") %> <% end %> 

i want add fields, example

<%= f.input :firstname %> 

when that, though, does appear in view, though it's not saving user model. so, figured needed modify controller. that's confused, think because i'm trying flop , forth between devise , devise_invitable readme's. i'm using devise 3.5.6 , devise_invitable 1.5.5. tried adding above input form, , changing applicaiton controller include

 before_action :configure_permitted_parameters, if: :devise_controller?   protected   def configure_permitted_parameters    devise_parameter_sanitizer.for(:sign_up) << :firstname  end 

but still doesn't save user model. have advice?

you permitting params pass on devise registrationscontroller create action. can see in definition, below params sanitizer :sign_up
devise_parameter_sanitizer.for(:sign_up) << :firstname

in case must :accept_invitation, since using devise_invitable , form submit url invitation_path submit devise::invitationscontroller#update

devise_parameter_sanitizer.for(:accept_invitation) |u|     u.permit(:firstname) end 

more details here


Comments