We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
change csv values before import, find each author by 'Author name' and replace it with its id before insert
ActiveAdmin.register Post do active_admin_import validate: true, headers_rewrites: { 'Author name': :author_id }, before_batch_import: ->(importer) { authors_names = importer.values_at(:author_id) # replacing author name with author id authors = Author.where(name: authors_names).pluck(:name, :id) options = Hash[*authors.flatten] # #{"Jane" => 2, "John" => 1} importer.batch_replace(:author_id, options) } end