mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Replace alias_attribute with alias_method
This commit is contained in:
@@ -25,11 +25,13 @@ class Customer < ApplicationRecord
|
||||
before_destroy :update_orders_and_delete_canceled_subscriptions
|
||||
|
||||
belongs_to :bill_address, class_name: "Spree::Address", optional: true
|
||||
alias_attribute :billing_address, :bill_address
|
||||
alias_method :billing_address, :bill_address
|
||||
alias_method :billing_address=, :bill_address=
|
||||
accepts_nested_attributes_for :bill_address
|
||||
|
||||
belongs_to :ship_address, class_name: "Spree::Address", optional: true
|
||||
alias_attribute :shipping_address, :ship_address
|
||||
alias_method :shipping_address, :ship_address
|
||||
alias_method :shipping_address=, :ship_address=
|
||||
accepts_nested_attributes_for :ship_address
|
||||
|
||||
validates :code, uniqueness: { scope: :enterprise_id, allow_nil: true }
|
||||
|
||||
@@ -35,10 +35,12 @@ module Spree
|
||||
belongs_to :created_by, class_name: "Spree::User", optional: true
|
||||
|
||||
belongs_to :bill_address, class_name: 'Spree::Address', optional: true
|
||||
alias_attribute :billing_address, :bill_address
|
||||
alias_method :billing_address, :bill_address
|
||||
alias_method :billing_address=, :bill_address=
|
||||
|
||||
belongs_to :ship_address, class_name: 'Spree::Address', optional: true
|
||||
alias_attribute :shipping_address, :ship_address
|
||||
alias_method :shipping_address, :ship_address
|
||||
alias_method :shipping_address=, :ship_address=
|
||||
|
||||
has_many :state_changes, as: :stateful, dependent: :destroy
|
||||
has_many :line_items, -> {
|
||||
|
||||
@@ -24,8 +24,10 @@ class Subscription < ApplicationRecord
|
||||
has_many :proxy_orders, dependent: :destroy
|
||||
has_many :orders, through: :proxy_orders
|
||||
|
||||
alias_attribute :billing_address, :bill_address
|
||||
alias_attribute :shipping_address, :ship_address
|
||||
alias_method :billing_address, :bill_address
|
||||
alias_method :billing_address=, :bill_address=
|
||||
alias_method :shipping_address, :ship_address
|
||||
alias_method :shipping_address=, :ship_address=
|
||||
|
||||
accepts_nested_attributes_for :subscription_line_items, allow_destroy: true
|
||||
accepts_nested_attributes_for :bill_address, :ship_address
|
||||
|
||||
@@ -79,9 +79,6 @@ Rails.application.configure do
|
||||
|
||||
"Passing the class as positional argument",
|
||||
|
||||
# Spree::Order model aliases `bill_address`, but `bill_address` is not an attribute. Starting in Rails 7.2, alias_attribute with non-attribute targets will raise. Use `alias_method :billing_address, :bill_address` or define the method manually. (called from initialize at app/models/spree/order.rb:188)
|
||||
"alias_attribute with non-attribute targets will raise",
|
||||
|
||||
# Spree::CreditCard model aliases `cc_type` and has a method called `cc_type=` defined. Starting in Rails 7.2 `brand=` will not be calling `cc_type=` anymore. You may want to additionally define `brand=` to preserve the current behavior.
|
||||
"model aliases",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user