Extract, transform and load process with ruby.
Use the .:model
key to send the model in which you want to insert the information.
The insertion of data depends on whether the fields exist in the model
class UnitsController < ApplicationController
def import
service_result = EtlProcessor::Csv.call(model: Unit)
if service_result.success?
redirect_to units_url, notice: 'ETL process by CSV was successfully.'
else
redirect_to units_url, error: 'Something was wrong.'
end
end
...
end
Add this line to your application's Gemfile:
gem 'etl_processor'
And then execute:
$ bundle install
Bug report or pull request are welcome.
Make a pull request:
- Clone the repo
- Create your feature branch
- Commit your changes
- Push the branch
- Create new Pull-Request
The gem is available as open source under the terms of the MIT License.