Beam
A rubygem to simplifiy repetitive csv upload process for ActiveRecord models
Usage
Add it to the model you want to import csv file
extend Beam::Upload
Upload zipped csv file, e.g. users.csv.zip
Model.upload_file(file_name, file_path)
where users.csv has headers and rows, e.g.:
name,email
Test1,
Test2,[email protected]
Test3,[email protected]
Test4,[email protected]
Get the output as:
- response hash, e.g.
{:errors=>1, :status=>200, :total_rows=>4, :error_rows=>[["Test1", nil, "is invalid"]]}
- error file, e.g.
for users.csv file, it creates errors_users.csv at the same path
See beam/upload.rb for more details
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request