I added Devise to my Rails 4 application and successfully added a username, etc. into the User model. In addition, I can store these fields using the lazy way and trade, i.e.
class ApplicationController < ActionController::Base before_filter :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :firstname, :middlename, :lastname) } end end
However i tried
def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :firstname, :middlename, :lastname) } devise_parameter_sanitizer.for(:edit) { |u| u.permit(:email, :password, :password_confirmation, :firstname, :middlename, :lastname) } end
but this does not work as expected (the username is not saved when invoked by the edit action). Is there anything else I need to do to get this to work? Thank!
ruby-on-rails-4 devise strong-parameters
conciliator Nov 05 '13 at 14:39 2013-11-05 14:39
source share