Module: Vpago::ProductDecorator

Defined in:
app/models/vpago/product_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/models/vpago/product_decorator.rb', line 3

def self.prepended(base)
  base.has_many :payout_profile_products,
                class_name: 'Spree::PayoutProfileProduct', inverse_of: :product

  base.has_many :payout_profiles,
                class_name: 'Spree::PayoutProfile', through: :payout_profile_products,
                source: :payout_profile

  base.has_many :active_payout_profiles, -> { verified.active },
                class_name: 'Spree::PayoutProfile',
                through: :payout_profile_products, source: :payout_profile

  base.has_many :active_payway_payout_profiles, -> { payway.verified.active },
                class_name: 'Spree::PayoutProfile',
                through: :payout_profile_products, source: :payout_profile

  base.has_many :required_payout_profile_products, -> { required },
                class_name: 'Spree::PayoutProfileProduct',
                inverse_of: :product

  base.has_many :required_active_payout_profiles, -> { verified.active },
                class_name: 'Spree::PayoutProfile',
                through: :required_payout_profile_products, source: :payout_profile
end