I have a field user[role_id] in my form for user sign up form.
I have added param :role_id in
'protected
# If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:role_id])
end
# If you have extra params to permit, append them to the sanitizer.
def configure_account_update_params
devise_parameter_sanitizer.permit(:account_update, keys: [:role_id])
end
'
but while registering user role_id has not been inserted into database. Please help
Have you updated your registration form to send the role_id as a parameter of the request?
I'm new to ruby on rails. I have this field in form
<div class="form-group">
<select class="form-control" name="user[role_id]">
<%@roles.each do |role| %>
<option value="<%=role.id%>"><%=role.name %></option>
<%end%>
</select>
I'm using rails 5.0
Can you please provide a sample application that reproduces the error?
I found it was not an issue with devise but with myself. Sorry for spoiling your time. I did It myself. Thank you very much for your timely response.
Can you provide the answer that you found for others who may be having a similar issue?
@prdpspkt I am having the exact same issue, what did you do wrong? I am probably doing the ame mistake
i was able to resolve the issue by following
https://github.com/plataformatec/devise . The section of strong parameter
will help
On Mon, Aug 20, 2018 at 5:05 PM Adrien du Peloux notifications@github.com
wrote:
@prdpspkt https://github.com/prdpspkt I am having the exact same issue,
what did you do wrong? I am probably doing the ame mistake—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/plataformatec/devise/issues/4201#issuecomment-414371300,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AeYG0gZZjo76Ej8j4FFe4F1Noe97s-Joks5uSt4_gaJpZM4JNpAC
.
This worked for me, i wanted to add a first_name and last_name for registration
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])
end
end
Most helpful comment
This worked for me, i wanted to add a first_name and last_name for registration