found unpermitted parameters: utf8, authenticity_token only for update method

泄露秘密 提交于 2019-12-08 15:59:42

问题


I have the update method in user managements controller like this

def update
  @user.update(user_permitted_params)
  redirect_to admin_user_managements_path
end

My strong parameters is set as

def user_permitted_params
  params.require(:user).permit(:name, :email, :password,
  :password_confirmation,
  :address, :zip_code,
  :phone_number, :role_id)
end

I am getting following issue

Unpermitted parameters: utf8, _method, authenticity_token, user, commit


回答1:


I tried your code myself and the only explanation for your error is that you must have called @user.update(params) at some point.



来源:https://stackoverflow.com/questions/29275809/found-unpermitted-parameters-utf8-authenticity-token-only-for-update-method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!