From b947015bc28cadc8677d34666e207eeb79e4e4cd Mon Sep 17 00:00:00 2001 From: Filippo Liverani Date: Fri, 18 Dec 2020 12:49:12 +0100 Subject: [PATCH] Define preferences attribute only when used Since rails/rails@7b39197 serialezable hash attributes are not allocated by default anymore if not used. --- core/app/models/spree/base.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/app/models/spree/base.rb b/core/app/models/spree/base.rb index 95916b12d5c..6e0a3dba974 100644 --- a/core/app/models/spree/base.rb +++ b/core/app/models/spree/base.rb @@ -3,8 +3,6 @@ class Spree::Base < ActiveRecord::Base include Spree::Preferences::Preferable include Spree::Core::Permalinks - serialize :preferences, Hash - include Spree::RansackableAttributes def initialize_preference_defaults @@ -18,6 +16,7 @@ def initialize_preference_defaults def self.preference(*args) # after_initialize can be called multiple times with the same symbol, it # will only be called once on initialization. + serialize :preferences, Hash after_initialize :initialize_preference_defaults super end