activerecord-import icon indicating copy to clipboard operation
activerecord-import copied to clipboard

way to access objects errors and halt a record from callback

Open charithreddyv opened this issue 2 years ago • 0 comments

Hai there, i have just started using activerecord-import i am following the way of creating a object and doing import and also setting run_callbacks along with validate_uniqueness: true when import fails i get an array of failed_instances but is there is way i can access the error?

what i mean is in models before_save callback i do some checks and add error to the object like errors.add("My error") and throw(:abort) return false but this does not stop from Model.import to continue insert that record.

my question is, how to stop import to fail for a specific object in an array and how to show the errors that are added that model ?

charithreddyv avatar Nov 18 '21 16:11 charithreddyv