activeadmin-plugins / active_admin_import

:paperclip: active_admin_import is based on activerecord-import gem - the most efficient way to import for ActiveAdmin
http://activeadmin-plugins.github.io/active_admin_import
MIT License
184 stars 101 forks source link

I get an error when importing data into User model #145

Closed sinansh closed 7 years ago

sinansh commented 7 years ago

I am using devise gem for user session operations. I want to import data to the user model in the admin panel.

admin/user.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

models/user.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

I received the error message: can't write unknown attribute password

Ruby version: 2.4.1p111 Rails version: Rails 5.1.4

How can I resolve this error?

Fivell commented 7 years ago

@sinansahin duplicate of #16 ?