From e98244fe63fc9cae973e6f65b747e10f0a3f4832 Mon Sep 17 00:00:00 2001 From: Pavel Date: Thu, 19 Feb 2026 21:55:13 +0000 Subject: [PATCH 1/3] Fix Rails 7.2 serialize deprecation warnings Pass type as keyword argument in serialize calls, as required from Rails 7.2 onwards. Co-Authored-By: Claude Sonnet 4.6 --- app/models/invoice.rb | 2 +- app/models/report_rendering_options.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 69c89d673f..0f75424c76 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -4,7 +4,7 @@ class Invoice < ApplicationRecord self.belongs_to_required_by_default = false belongs_to :order, class_name: 'Spree::Order' - serialize :data, Hash, coder: YAML + serialize :data, type: Hash, coder: YAML before_validation :serialize_order after_create :cancel_previous_invoices default_scope { order(created_at: :desc) } diff --git a/app/models/report_rendering_options.rb b/app/models/report_rendering_options.rb index dd69ecf887..79b0e67507 100644 --- a/app/models/report_rendering_options.rb +++ b/app/models/report_rendering_options.rb @@ -4,5 +4,5 @@ class ReportRenderingOptions < ApplicationRecord self.belongs_to_required_by_default = false belongs_to :user, class_name: "Spree::User" - serialize :options, Hash, coder: YAML + serialize :options, type: Hash, coder: YAML end From 98775bfdb80ee4e85eb33c950a08b57fdd01486d Mon Sep 17 00:00:00 2001 From: Pavel Date: Sat, 21 Feb 2026 23:21:08 +0000 Subject: [PATCH 2/3] Pass type as keyword argument in migration serialize call Same fix as applied to Invoice and ReportRenderingOptions models in the parent PR: Rails 7.2 requires the type class to be passed as a keyword argument to serialize. serialize :options, Hash, coder: YAML -> serialize :options, type: Hash, coder: YAML Co-Authored-By: Claude Sonnet 4.6 --- .../20241011071014_update_item_name_to_product_in_od_report.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20241011071014_update_item_name_to_product_in_od_report.rb b/db/migrate/20241011071014_update_item_name_to_product_in_od_report.rb index 6344d91188..00edf95945 100644 --- a/db/migrate/20241011071014_update_item_name_to_product_in_od_report.rb +++ b/db/migrate/20241011071014_update_item_name_to_product_in_od_report.rb @@ -3,7 +3,7 @@ class UpdateItemNameToProductInOdReport < ActiveRecord::Migration[7.0] self.belongs_to_required_by_default = false belongs_to :user, class_name: "Spree::User" - serialize :options, Hash, coder: YAML + serialize :options, type: Hash, coder: YAML end # OD: Orders and Distributors From 85c903cb7f66eaeb84ded723b5a82185ad0c5af6 Mon Sep 17 00:00:00 2001 From: Pavel Date: Mon, 23 Feb 2026 23:30:48 +0000 Subject: [PATCH 3/3] Remove fixed serialize deprecation from allowed warnings The "Passing the class as positional argument" warning was suppressed while serialize calls were being updated to use the keyword argument form. Now that the fix is applied, the suppression is no longer needed. Co-Authored-By: Claude Sonnet 4.6 --- config/environments/test.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index 2dc933a434..3d50e5348d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -74,8 +74,6 @@ Rails.application.configure do allowed_warnings = [ # List strings here to allow matching deprecations. # - "Passing the class as positional argument", - # Spree::CreditCard model aliases `cc_type` and has a method called `cc_type=` defined. Starting in Rails 7.2 `brand=` will not be calling `cc_type=` anymore. You may want to additionally define `brand=` to preserve the current behavior. "model aliases",