Verified Commit 1a070fa8 authored by Alexis Reigel's avatar Alexis Reigel
Browse files

document model validation

parent 8fe2908a
Pipeline #20582 passed with stage
in 13 minutes and 27 seconds
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment