Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

way to access objects errors and halt a record from callback #754

Open
charithreddyv opened this issue Nov 18, 2021 · 0 comments
Open

way to access objects errors and halt a record from callback #754

charithreddyv opened this issue Nov 18, 2021 · 0 comments

Comments

@charithreddyv
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant