diff --git a/README.md b/README.md index 19b98043ae74a00e49c9e2db0a4a3d7f0d2c97e2..2623a12af545e7fac0d0fda5d8686299affc17a0 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,20 @@ import = UserImport.new import.run # calls User.create!(row) for each row ``` +### Model validation + +A summary of the `ActiveRecord` model validations is available after running +the importer. The `Error` objects indicates the failed excel row and the +corresponding errors. + +```ruby +import = UserImport.new +import.run + +import.errors[:model] +# => [#<struct Excelsior::Error row=3, errors=["First name can't be blank"]>] +``` + ### Extended API You may want to pass an excel file per instance. You can also define your own