Closed wowu closed 2 years ago
Hi @Wowu, could you please check if version 3.0.2 released today still fixes this issue for you. I changed the implementation around in #128 (specifically this commit https://github.com/stephskardal/rails_admin_import/pull/128/commits/53e2d39a015f1ff7767a47b67c823706598d1f1e) to keep it consistent with other hooks while making sure that editing the record in the hook would affect the import.
Yes, it still fixes the issue, thanks!
Is is suggested in README to delete attributes from imported record in
before_import_attributes
hook:https://github.com/stephskardal/rails_admin_import/blob/1cb05ba12176736cbc78f9ece6a8174c0577af90/README.md?plain=1#L317-L321
In
importer.rb
the callback is called withrecord
, butnew_attrs
are assigned to model attributes, thus making it impossible to alter new attributes using the hook:https://github.com/stephskardal/rails_admin_import/blob/1cb05ba12176736cbc78f9ece6a8174c0577af90/lib/rails_admin_import/importer.rb#L206-L213
If I understand it correctly,
new_attrs
should be passed to the callback instead ofrecord
.