ruby - Rails, Devise can't update my new fields like username -
i added :login, :username fields on users table. sign , login work perfectly. changed devise.rb authenticate :login instead of :email users can login own unique login id.
however, updating email , username fields on edit.html not insert record mysql2 db.
i don't find errors on console. although parameters delivered, record not inserted.
here gist address.
if need update
devise model newly added attributes, need permit them explicitly(strong parameters in rails 4). example :
class applicationcontroller < actioncontroller::base before_filter :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.for(:account_update) << :username ## add attributes want permit end end
refer devise documentation on handling strong parameters.
Comments
Post a Comment