Something that seems to be popping up early on in the Solidus 1.3.0.rc1 upgrades is issues with the new requirement that all orders have an attached store.
This was introduced in #935, which IMO is a great change, it will simplify a lot being able to rely on the store being set. However we should do whatever possible to make the upgrade smooth.
Previously, Store.default would return Store.new if there was no existing default (to simplify writing specs, presumably). This is no longer a valid "default" in most cases, since an id will be required to make the store valid. This will make operations like current_order(create_order_if_neccesary: true) break if no store is in the database.
Things we must do
Some options we could consider:
- @jrochkind suggests that
Store.default could create a default store if none exists. This would make current_order(create_order_if_neccesary: true) work in specs (largely) as it used to.
- Have
Store.default raise an error if there is no default Store. This won't make anything pass which was broken by this, but would give better indication of the issue.
- Drop the validation for the 1.3 release, and instead introduce a warning that we intend to validate this in the future.
- Drop the validation for the 1.3 release, and introduce a
Order#store_or_default to help any pieces of code which want to reliably get a store.
Something that seems to be popping up early on in the Solidus 1.3.0.rc1 upgrades is issues with the new requirement that all orders have an attached
store.This was introduced in #935, which IMO is a great change, it will simplify a lot being able to rely on the store being set. However we should do whatever possible to make the upgrade smooth.
Previously,
Store.defaultwould returnStore.newif there was no existing default (to simplify writing specs, presumably). This is no longer a valid "default" in most cases, since anidwill be required to make the store valid. This will make operations likecurrent_order(create_order_if_neccesary: true)break if no store is in the database.Things we must do
Some options we could consider:
Store.defaultcould create a default store if none exists. This would makecurrent_order(create_order_if_neccesary: true)work in specs (largely) as it used to.Store.defaultraise an error if there is no default Store. This won't make anything pass which was broken by this, but would give better indication of the issue.Order#store_or_defaultto help any pieces of code which want to reliably get a store.