Sha256: e98254c3389500384f277004fc87bd6cef3c4b2192430694485b3ebac53b2017

Contents?: true

Size: 329 Bytes

Versions: 1

Compression:

Stored size: 329 Bytes

Contents

class InitMasterVariants < ActiveRecord::Migration[5.0]
  def up
    Kms::Product.find_each do |product|
      unless product.master
        product.create_master(price: product.price, name: product.name)
      end
    end
  end

  def down
    Kms::Product.find_each do |product|
      product.master&.destroy
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kms_catalog-0.5.0 db/migrate/20170112135659_init_master_variants.rb