Sha256: 82e2d013a7d528cd14b26cc41ee73f4a0629d9926ae230ea84b6c2300c6c1be1
Contents?: true
Size: 468 Bytes
Versions: 6
Compression:
Stored size: 468 Bytes
Contents
module CsvPiper module Processors class CreateActiveModel def initialize(model_class) @model_class = model_class end def process(source, transformed, errors) model = @model_class.new(transformed) model.save if model.valid? && errors.empty? errors.errors.merge!(model.errors.to_hash) do |key, old_val, new_val| old_val + new_val end [transformed, errors] end end end end
Version data entries
6 entries across 6 versions & 1 rubygems