Ruby on rails 我的模型没有';除了设计的领域外,不要拯救其他领域
我正在用Rails开发一个web应用程序,我正在使用Desive gem。我在“设计注册”视图中添加了一个字段,但当我注册用户时,数据库中只有该字段为空。我错过什么了吗?提前谢谢。这是因为我们设计了强力参数消毒剂。只需将以下行添加到Ruby on rails 我的模型没有';除了设计的领域外,不要拯救其他领域,ruby-on-rails,devise,Ruby On Rails,Devise,我正在用Rails开发一个web应用程序,我正在使用Desive gem。我在“设计注册”视图中添加了一个字段,但当我注册用户时,数据库中只有该字段为空。我错过什么了吗?提前谢谢。这是因为我们设计了强力参数消毒剂。只需将以下行添加到应用程序\u controller.rb protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) << :first_na
应用程序\u controller.rb
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :first_name
end
Ref:这是因为Rails 4中引入了强参数
before_filter :configure_permitted_parameters, if: :devise_controller?