Sha256: d494ae5c3ea28fe0e8ea3643c740aef703d870e211c80f4ea8e1b44921b59ef9
Contents?: true
Size: 785 Bytes
Versions: 1
Compression:
Stored size: 785 Bytes
Contents
module ImporterHelper def self.run(&block) customer = ENV['CUSTOMER_DOMAIN'] ActiveRecord::Base.transaction do case customer when 'ALL' Customer.all.each do |customer_instance| puts "Importing for the customer \"#{customer_instance}\"..." Uploader.set_current_domain(customer_instance.domain) customer_instance.using_connection do block.call end puts "Imported for the customer \"#{customer_instance}\"" end when nil block.call else Uploader.set_current_domain(customer) Customer.find_by_domain(customer).using_connection do block.call end puts "Imported for the customer \"#{customer}\"" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unico-training-7.8.0 | lib/importer_helper.rb |