1

我创建了一个公司模型,我希望它能够使用设计进行注册。

这是代码:

lib/sanitizers/company_sanitizer.rb

class Company::ParameterSanitizer < Devise::ParameterSanitizer

  def sign_in
      default_params.permit(:subdomain, :plan, :email)
  end
end

\

config/initializers/sanitizers.rb

require "#{Rails.application.root}/lib/sanitizers/company_sanitizer.rb"

最后是 application_controller.rb

protected
  def devise_parameter_sanitizer
    if resource_class == Company
      Company::ParameterSanitizer.new(Company, :company, params)
    else
      super
    end
  end

现在,问题是那些额外的参数被忽略了:

log/development.log

Unpermitted parameters: plan, subdomain

我做错了什么,我想不通!?

4

0 回答 0