Custom field for devise on Rails 5 -
i have installed devise gem , added custom fields database fullname
, location
strings.
i updated edit
, new
form pages as:
<%= f.input :fullname, required: true %> <%= f.input :location %>
but doesn't save or update fields.
what missing? went through tens of tutorials, can't figure out.
i'm using rails 5.1.3 , ruby 2.4.0p0.
you can in "lazy way" using configure_permitted_parameters
before filter.
in applicationcontroller add protected method specifying keys permit in devise_parameter_sanitizer
. add before_action callback pointing method if controller being used devise registered controller.
in case maybe like:
class applicationcontroller < actioncontroller::base before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters permit_attrs(%i[fullname location]) end def permit_attrs(attrs) %i[sign_up account_update].each |action| devise_parameter_sanitizer.permit(action, keys: attrs) end end end
Comments
Post a Comment