Module: SolidusSubscriptions::Spree::User::HaveManySubscriptions

Defined in:
app/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb', line 8

def self.prepended(base)
  base.has_many(
    :subscriptions,
    class_name: 'SolidusSubscriptions::Subscription',
    foreign_key: 'user_id'
  )

  base.accepts_nested_attributes_for :subscriptions
end

Instance Method Details

#subscriptions_attributes=(params) ⇒ Object



18
19
20
21
22
23
24
# File 'app/decorators/models/solidus_subscriptions/spree/user/have_many_subscriptions.rb', line 18

def subscriptions_attributes=(params)
  ::Spree::Deprecation.warn(
    'Creating or updating subscriptions through Spree::User nested attributes is deprecated. ' \
    'Please use subscriptions APIs directly.'
  )
  super
end