Sha256: 3954b2195a81524f2d1f7a7abef8a76c14a293368926e26bd46afde4a41b3ad3

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

# This migration comes from spree (originally 20150506181611)
class CreateSpreeStoreCreditPaymentMethod < ActiveRecord::Migration
  class PaymentMethod < Spree::Base
    self.table_name = 'spree_payment_methods'
    self.inheritance_column = :_type_disabled
  end
  def up
    # If migrating from Spree 3.0, the environment column is already gone.
    # We remove it in a later migration if upgrading from spree <= 2.4 to soldius
    if column_exists?(:spree_payment_methods, :environment)
      attributes = {type: "Spree::PaymentMethod::StoreCredit", environment: Rails.env}
    else
      attributes = {type: "Spree::PaymentMethod::StoreCredit"}
    end
    PaymentMethod.create_with(
      name: Spree.t("store_credit.store_credit"),
      description: Spree.t("store_credit.store_credit"),
      active: true,
      display_on: 'none',
    ).find_or_create_by!(attributes)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_order_reporting-0.0.2 spec/dummy/db/migrate/20160707103582_create_spree_store_credit_payment_method.spree.rb
spree_order_reporting-0.0.1 spec/dummy/db/migrate/20160706112534_create_spree_store_credit_payment_method.spree.rb