Sha256: 69e64e86e9db52df364f9c5d37e58a19ad595f70af6be4669165b744adbf2a35

Contents?: true

Size: 590 Bytes

Versions: 34

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

class Spree::WalletPaymentSource < ActiveRecord::Base
  belongs_to :user, class_name: Spree::UserClassHandle.new, foreign_key: 'user_id', inverse_of: :wallet_payment_sources
  belongs_to :payment_source, polymorphic: true, inverse_of: :wallet_payment_sources

  validates_presence_of :user
  validates_presence_of :payment_source

  validate :check_for_payment_source_class

  private

  def check_for_payment_source_class
    if !payment_source.is_a?(Spree::PaymentSource)
      errors.add(:payment_source, :has_to_be_payment_source_class)
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
solidus_core-2.8.6 app/models/spree/wallet_payment_source.rb
solidus_core-2.6.6 app/models/spree/wallet_payment_source.rb
solidus_core-2.7.4 app/models/spree/wallet_payment_source.rb
solidus_core-2.8.5 app/models/spree/wallet_payment_source.rb
solidus_core-2.7.3 app/models/spree/wallet_payment_source.rb
solidus_core-2.6.5 app/models/spree/wallet_payment_source.rb
solidus_core-2.8.4 app/models/spree/wallet_payment_source.rb
solidus_core-2.8.3 app/models/spree/wallet_payment_source.rb
solidus_core-2.7.2 app/models/spree/wallet_payment_source.rb
solidus_core-2.6.4 app/models/spree/wallet_payment_source.rb
solidus_core-2.8.2 app/models/spree/wallet_payment_source.rb
solidus_core-2.8.1 app/models/spree/wallet_payment_source.rb
solidus_core-2.6.3 app/models/spree/wallet_payment_source.rb
solidus_core-2.8.0 app/models/spree/wallet_payment_source.rb
solidus_core-2.7.1 app/models/spree/wallet_payment_source.rb
solidus_core-2.6.2 app/models/spree/wallet_payment_source.rb
solidus_core_devise_token_auth-2.8.0.alpha.14 app/models/spree/wallet_payment_source.rb
solidus_core_devise_token_auth-2.8.0.alpha.13 app/models/spree/wallet_payment_source.rb
solidus_core_devise_token_auth-2.8.0.alpha.12 app/models/spree/wallet_payment_source.rb
solidus_core_devise_token_auth-2.8.0.alpha.11 app/models/spree/wallet_payment_source.rb