Skip to content

Commit

Permalink
Replace explicit shipping_address and billing_address attributes
Browse files Browse the repository at this point in the history
Due to deprecations, with a previous commit we replaced `alias_attribute`
calls for these two attributes with `alias_method`, but the latter doesn't
fully cover the previous behavior.

When `shipping_address` or `billing_address` are passed as attributes,
the error `ActiveModel::UnknownAttributeError` is now raised. For this
reason, we're starting to replace them with the right association name.

We may want to revisit the possibility to still use `billing_address` and
`shipping_address` as providing these aliases doesn't seem to be fully
viable anymore.
  • Loading branch information
spaghetticode committed Dec 14, 2023
1 parent 0c2fe34 commit b168271
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sample/db/samples/orders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
store = Spree::Store.first!

orders = []
binding.irb

orders << Spree::Order.create!(
number: "R123456789",
email: "[email protected]",
item_total: 150.95,
adjustment_total: 150.95,
total: 301.90,
shipping_address: Spree::Address.first,
billing_address: Spree::Address.last
ship_address: Spree::Address.first,
bill_address: Spree::Address.last
)

orders << Spree::Order.create!(
Expand All @@ -23,8 +25,8 @@
item_total: 15.95,
adjustment_total: 15.95,
total: 31.90,
shipping_address: Spree::Address.first,
billing_address: Spree::Address.last
ship_address: Spree::Address.first,
bill_address: Spree::Address.last
)

orders[0].line_items.create!(
Expand Down

0 comments on commit b168271

Please sign in to comment.