Reputation: 30056
I'm developing a web application with Rails and I'm using Devise gem. I added a field in Devise registration view but when I sign up a user, in the database only that field is empty. Am I missing something? Thank you in advance.
Upvotes: 0
Views: 80
Reputation: 1205
This is because Devise strong parameter sanitizer. Just add following lines to your application_controller.rb
.
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :first_name
end
and call this configure_permitted_parameters
method before filter for devise controller using before_filter
.
before_filter :configure_permitted_parameters, if: :devise_controller?
Ref: https://github.com/plataformatec/devise#strong-parameters
Upvotes: 1