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.
Asked
Active
Viewed 76 times
0
-
3It's because strong params was introduced in Rails 4 http://stackoverflow.com/a/11999563/1500195 – 6ft Dan Nov 08 '14 at 13:52
1 Answers
1
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

vs4vijay
- 1,175
- 3
- 14
- 28