Module: Spree::DeprecatedCustomerAlias

Extended by:
ActiveSupport::Concern
Included in:
CreditCard, CustomerGroupUser, GatewayCustomer, GiftCard, NewsletterSubscriber, PaymentSource, PromotionRuleUser, StoreCredit, Wishlist
Defined in:
app/models/concerns/spree/deprecated_customer_alias.rb

Overview

Deprecation shim for the 6.0 user_id -> customer_id / belongs_to :user -> :customer rename. Included by customer-facing models so .user / .user_id keep working until Spree 6.3.

Instance Method Summary collapse

Instance Method Details

#user ⇒ Object



12
13
14
15
16
17
18
19
# File 'app/models/concerns/spree/deprecated_customer_alias.rb', line 12

def user
  if defined?(Spree::Deprecation)
    Spree::Deprecation.warn(
      "#{self.class}#user is deprecated and will be removed in Spree 6.3. Use #customer instead."
    )
  end
  customer
end

#user=(value) ⇒ Object



21
22
23
24
25
26
27
28
# File 'app/models/concerns/spree/deprecated_customer_alias.rb', line 21

def user=(value)
  if defined?(Spree::Deprecation)
    Spree::Deprecation.warn(
      "#{self.class}#user= is deprecated and will be removed in Spree 6.3. Use #customer= instead."
    )
  end
  self.customer = value
end