Skip to content

Commit

Permalink
Revert "Merge pull request solidusio#3998 from nebulab/kennyadsl/fix-…
Browse files Browse the repository at this point in the history
…preferences-serialization"

This reverts commit bcea9e1, reversing
changes made to a9a7a95.
  • Loading branch information
mamhoff committed Mar 28, 2021
1 parent 39a9d7d commit 38c856c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
10 changes: 1 addition & 9 deletions core/app/models/spree/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ class Spree::Base < ActiveRecord::Base
include Spree::Core::Permalinks
include Spree::RansackableAttributes

def preferences
read_attribute(:preferences) || self.class.preferences_coder_class.new
end

def initialize_preference_defaults
if has_attribute?(:preferences)
self.preferences = default_preferences.merge(preferences)
Expand All @@ -20,15 +16,11 @@ 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, preferences_coder_class
serialize :preferences, Hash
after_initialize :initialize_preference_defaults
super
end

def self.preferences_coder_class
Hash
end

self.abstract_class = true

# Provides a scope that should be included any time products
Expand Down
18 changes: 0 additions & 18 deletions core/spec/models/spree/stock/estimator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,6 @@ module Stock
context "general shipping methods" do
before { Spree::ShippingMethod.all.each(&:destroy) }

context 'with a custom shipping calculator with no preference' do
class Spree::Calculator::Shipping::NoPreferences < Spree::ShippingCalculator
def compute_package(_package)
# no op
end
end

let!(:shipping_methods) do
[
create(:shipping_method, calculator: Spree::Calculator::Shipping::NoPreferences.new)
]
end

it 'does not raise an error' do
expect { subject.shipping_rates(package) }.not_to raise_error
end
end

context 'with two shipping methods of different cost' do
let!(:shipping_methods) do
[
Expand Down

0 comments on commit 38c856c

Please sign in to comment.