@spree/docs 0.1.172 → 0.1.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -87,7 +87,7 @@ paths:
|
|
|
87
87
|
content:
|
|
88
88
|
application/json:
|
|
89
89
|
example:
|
|
90
|
-
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImRlZmM5YWZhLTUzOTYtNDEwYy1hZDY4LTE4YTBiN2M5MmMwMyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.
|
|
90
|
+
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImRlZmM5YWZhLTUzOTYtNDEwYy1hZDY4LTE4YTBiN2M5MmMwMyIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.ha-8UOgpGEgYAVWjEqzhLZ9LPtI6uTlsDB3We7qbrdU
|
|
91
91
|
refresh_token: CxKP3VYWQzkXqrfxTmPLB446
|
|
92
92
|
user:
|
|
93
93
|
id: cust_UkLWZg9DAJ
|
|
@@ -194,7 +194,7 @@ paths:
|
|
|
194
194
|
content:
|
|
195
195
|
application/json:
|
|
196
196
|
example:
|
|
197
|
-
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjFmMzM5OGY2LTczZDgtNDdjNi1hNDk4LTUxNDc3MGUxYTUyNSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.
|
|
197
|
+
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjFmMzM5OGY2LTczZDgtNDdjNi1hNDk4LTUxNDc3MGUxYTUyNSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.Zpvl-ISrctLW34O3zJFteOf3wMDNvlymVKsbkCIfeew
|
|
198
198
|
refresh_token: mWbQ77onTSsXQta8Z4SAVaTU
|
|
199
199
|
user:
|
|
200
200
|
id: cust_UkLWZg9DAJ
|
|
@@ -393,7 +393,7 @@ paths:
|
|
|
393
393
|
content:
|
|
394
394
|
application/json:
|
|
395
395
|
example:
|
|
396
|
-
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjdlOGI2Njc5LTBjNzYtNDQ1Mi1hMWMyLWJhY2U0MWNhN2IyMCIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.
|
|
396
|
+
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjdlOGI2Njc5LTBjNzYtNDQ1Mi1hMWMyLWJhY2U0MWNhN2IyMCIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.grC4diUECUp8b3p6jJBHAZp_MyiSUQwA4rdQLel_zuM
|
|
397
397
|
refresh_token: JNJKeT5cELhdSfb2tWHj3ctp
|
|
398
398
|
user:
|
|
399
399
|
id: cust_UkLWZg9DAJ
|
|
@@ -7086,7 +7086,7 @@ paths:
|
|
|
7086
7086
|
content:
|
|
7087
7087
|
application/json:
|
|
7088
7088
|
example:
|
|
7089
|
-
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjY0OWM2NTkzLTBhZWQtNDA5Ny1hYTI3LThhMjVmYTU4OGI3OSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.
|
|
7089
|
+
token: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6IjY0OWM2NTkzLTBhZWQtNDA5Ny1hYTI3LThhMjVmYTU4OGI3OSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzY4NDgyMDAwfQ.llCt1j8kVryteixNYywlzA1x8CGqCNBaKiT3-ihDrsE
|
|
7090
7090
|
refresh_token: mLm6vdSzLUgPhw8SCzDiagfL
|
|
7091
7091
|
user:
|
|
7092
7092
|
id: cust_UkLWZg9DAJ
|
|
@@ -353,11 +353,30 @@ A store or channel still carrying `preferred_order_routing_strategy: 'Spree::Ord
|
|
|
353
353
|
|
|
354
354
|
`Spree::Stock::Coordinator` itself stays — cart fulfillment building, exchanges, and claims still use it.
|
|
355
355
|
|
|
356
|
+
### `belongs_to` is required by default
|
|
357
|
+
|
|
358
|
+
Spree models followed Rails' pre-5 rule, where a `belongs_to` was optional
|
|
359
|
+
unless you said otherwise. They now follow the modern default: a `belongs_to`
|
|
360
|
+
is **required** unless it is declared `optional: true`.
|
|
361
|
+
|
|
362
|
+
Two consequences for an application built on Spree:
|
|
363
|
+
|
|
364
|
+
- **Your own models change with it.** Anything inheriting from `Spree::Base`
|
|
365
|
+
picks up the new default, so an association that is legitimately blank now
|
|
366
|
+
needs `optional: true` on it. A model that relied on the old behaviour will
|
|
367
|
+
start failing validation until you say which associations are optional.
|
|
368
|
+
- **The message changed.** A missing association reports `"must exist"` rather
|
|
369
|
+
than `"can't be blank"`. Code that matches on the old wording — a test, or a
|
|
370
|
+
client reading `details` out of a 422 — needs updating.
|
|
371
|
+
|
|
372
|
+
Setting a record's association to `nil` and saving it is the quickest way to
|
|
373
|
+
tell whether an association is required.
|
|
374
|
+
|
|
356
375
|
### `Store.default` no longer builds a store
|
|
357
376
|
|
|
358
377
|
`Spree::Store.default` returned an **unpersisted** `Store.new(default: true)` when no default store existed. It now returns `nil`.
|
|
359
378
|
|
|
360
|
-
This matters more than it looks: `Spree::Current.store` falls back to `Store.default`, and every `Spree::SingleStoreResource` model resolves its own `store` from `Spree::Current.store`. Without a default store, those records now fail validation with "Store
|
|
379
|
+
This matters more than it looks: `Spree::Current.store` falls back to `Store.default`, and every `Spree::SingleStoreResource` model resolves its own `store` from `Spree::Current.store`. Without a default store, those records now fail validation with "Store must exist" instead of silently attaching to a throwaway store.
|
|
361
380
|
|
|
362
381
|
Make sure a default store exists before creating store-scoped records, and set `Spree::Current.store` in jobs, rake tasks, and tests that run outside a request.
|
|
363
382
|
|