Skip to content

Default store headaches on 1.3 #1225

@jhawthorn

Description

@jhawthorn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions