stephskardal / rails_admin_import

Rails Admin Import functionality
http://www.endpoint.com/
MIT License
160 stars 122 forks source link

Hook Problems When Importing Data #67

Closed danilogarcia024 closed 6 years ago

danilogarcia024 commented 8 years ago

I'm trying to create an association where it does not exist before rails_admin_import gem is going to import a record.

It's not creating the association.

def before_import_save(record)
    if Collection.where(title: record[:product_collection]).empty?
      collection = Collection.create!(title: record[:product_collection], site: site)
    end
  end

An image of the error when I upload a file:

captura de pantalla 2016-04-07 a las 11 50 30 p m

What could be happening here?

dmitrypol commented 8 years ago

Can you attach the file? What else does it say in your rails_admin_import.log? Did you turn on config.logging = true?

monkbroc commented 6 years ago

I added a new before_import_associations(record) hook that should help in situations like these