我正在使用设计 gem 进行用户会话操作。我想将数据导入管理面板中的用户模型。
红宝石版本:2.4.1p111
Rails 版本:Rails 5.1.4
管理面板 gem:activeadmin
管理面板导入 gem:active_admin_import
管理员/用户.rb
ActiveAdmin.register User do
active_admin_import validate: true,
template_object: ActiveAdminImport::Model.new(
hint: "Dosyanızda veriler belirtilen başlıklar altında olmalıdır: 'email', 'identity_no', 'password', 'password_confirmation'",
csv_headers: ['email', 'identity_no', 'password', 'password_confirmation']
)
permit_params :email, :identity_no, :password, :password_confirmation
....
...
end
模型/用户.rb
class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_one :profile, dependent: :destroy
has_many :graduations, dependent: :destroy
has_many :works, dependent: :destroy
validates :identity_no, presence: true
...
...
end
我收到错误消息:
can't write unknown attribute password
如何解决此错误?