@spree/docs 0.1.150 → 0.1.151
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.
|
@@ -300,6 +300,21 @@ These were deprecated in 5.x and are **gone now** — there is no bridge, so cal
|
|
|
300
300
|
| `Product.add_search_scope` | plain `scope :name, -> { ... }` |
|
|
301
301
|
| `Spree::Image::Configuration::ActiveStorage` | deleted — an empty no-op module; all logic lives in `Spree::Asset` |
|
|
302
302
|
| `Spree::OrderRouting::Strategy::Legacy` | `Spree::OrderRouting::Strategy::Rules` (see below) |
|
|
303
|
+
| `private_metafields` association | read `custom_fields` and filter, or query `Spree::CustomField.admin_only` |
|
|
304
|
+
|
|
305
|
+
### Custom fields replace metafields
|
|
306
|
+
|
|
307
|
+
The metafields system is now custom fields: `Spree::CustomField` and `Spree::CustomFieldDefinition`, stored in `spree_custom_fields` and `spree_custom_field_definitions`. The legacy class names, the concern, and the reader methods all keep working for one release with a deprecation warning (see the table further down), so most applications need no code change to upgrade.
|
|
308
|
+
|
|
309
|
+
Two things do change under you, both handled by `db:migrate`:
|
|
310
|
+
|
|
311
|
+
- **Visibility is a boolean.** The tri-state `display_on` column collapses into `storefront_visible`. Definitions that were `back_end` become `storefront_visible: false`; everything else becomes `true`. The `front_end`-only value never meant hidden-from-staff and folds into `true`.
|
|
312
|
+
- **Two columns are renamed.** `name` becomes `label`, and `metafield_type` becomes `field_type`. Reading `field_type` returns the API token (`short_text`) rather than the Ruby class name; use `field_type_class_name` when you need the class.
|
|
313
|
+
- **Rich-text values leave Action Text.** `Spree::CustomFields::RichText` stores sanitized HTML in the same `value` column as every other type, so reading `value` returns a String rather than an `ActionText::RichText`. Existing bodies are copied across by the migration; the Action Text rows stay behind as a rollback path until 6.1. Code calling `custom_field.value.body` should read `value` directly.
|
|
314
|
+
|
|
315
|
+
Two behavior notes for extension authors: `Spree::Metadata` no longer includes the custom-fields concern (metadata is the private, schemaless system — include `Spree::HasCustomFields` explicitly if a model needs both), and rich-text values are now sanitized on save, so markup outside the allowlist is stripped rather than stored.
|
|
316
|
+
|
|
317
|
+
**BREAKING — product CSV.** Custom-field columns are now prefixed `custom_field.` instead of `metafield.` (for example `custom_field.custom.material`). Exports emit the new prefix and imports only recognise the new prefix, so update any saved import templates and any integration that reads the export. A file still using the old prefix imports without its custom-field values rather than failing.
|
|
303
318
|
|
|
304
319
|
### The Legacy order-routing strategy is gone
|
|
305
320
|
|
|
@@ -377,6 +392,13 @@ Every rename keeps the legacy name working for one release with a deprecation wa
|
|
|
377
392
|
| `order.completed` event | `order.placed` |
|
|
378
393
|
| Calling cart services with `order:` kwargs | `cart:` kwargs |
|
|
379
394
|
| `OrderWalkthrough` (testing support) | factories: `:cart_ready_for_delivery`, `:cart_ready_to_complete`, `:completed_order_with_totals` |
|
|
395
|
+
| `Spree::Metafield`, `Spree::MetafieldDefinition`, `Spree::Metafields::*` | `Spree::CustomField`, `Spree::CustomFieldDefinition`, `Spree::CustomFields::*` |
|
|
396
|
+
| `include Spree::Metafields` | `include Spree::HasCustomFields` |
|
|
397
|
+
| `#set_metafield`, `#get_metafield`, `#has_metafield?` | `#set_custom_field`, `#get_custom_field`, `#has_custom_field?` |
|
|
398
|
+
| `metafields` / `public_metafields` associations | `custom_fields` / `storefront_custom_fields` |
|
|
399
|
+
| `.with_metafield_key`, `.with_metafield_key_value` | `.with_custom_field_key`, `.with_custom_field_key_value` |
|
|
400
|
+
| `Spree.metafields` | `Spree.custom_fields` |
|
|
401
|
+
| `CustomFieldDefinition#name`, `#metafield_type`, `#display_on` | `#label`, `#field_type`, `#storefront_visible` (columns renamed) |
|
|
380
402
|
|
|
381
403
|
## Staff permissions: roles are data
|
|
382
404
|
|