简体   繁体   English

不允许的参数ActiveAdmin Devise Rails

[英]Unpermitted parameter ActiveAdmin Devise Rails

I both added username on signup page form and added the same name table column on MySQL database, however, when I click the sign up button, the error message appears and it's never inserted into the table: the rest of the data, email and password, is inserted properly. 我既在注册页面表单上添加了用户名,又在MySQL数据库上添加了相同的名称表列,但是,当我单击“注册”按钮时,错误消息出现,并且从未插入到表中:其余的数据,电子邮件和密码,已正确插入。

Here is the error message: 这是错误消息:

Unpermitted parameter: :username 不允许的参数::username

NOTE: username data is surely transmitted as POST parameter. 注意:用户名数据一定会作为POST参数传输。

Although I've tried a lot, such as adding permit_params on controller etc, they've never worked well. 尽管我已经尝试了很多,例如在控制器上添加了allow_params等,但是它们从来没有运行良好。

Any help or hint is appreciated. 任何帮助或提示表示赞赏。

My brief environment is below. 我的简短环境如下。

ruby 2.4.1p11 Rails 5.1.6 ActiveAdmin 1.3 Devise 4.4.3 红宝石2.4.1p11 Rails 5.1.6 ActiveAdmin 1.3设计4.4.3

Thank you. 谢谢。

Did you try to add to ApplicationController? 您是否尝试添加到ApplicationController?

def configure_permitted_parameters
  devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM