solidus_core 2.11.7 → 2.11.8
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.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/models/spree/base.rb +38 -20
- data/app/models/spree/calculator.rb +4 -0
- data/app/models/spree/payment_method.rb +3 -0
- data/app/models/spree/promotion_action.rb +3 -0
- data/app/models/spree/promotion_rule.rb +4 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/preferences/persistable.rb +23 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d36b03697769f4d9449dfeac2da6004e9d06b7d1575489abbbecf5497dfae1
|
4
|
+
data.tar.gz: a0de4d86e474402ac44765317ab8ffb2967dbb4de6675491616af185e17fb3dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f1a2577af4ea0108060bb3e9d81e81fa7114813b6ce5b1d925f53378da6b2f9c41b5e22d67d65389d2ee4e3d57719c79855fa4bbbb820f0cac68b63afeb313a
|
7
|
+
data.tar.gz: f4bf3efd9563905b2eca58c6df0b95c9c1591b0a46c07cbc4bfaaed0000cd691f2e9333dc7f860c78a0a450c38f38f2a74d1b8ab63f15e188ac46de5d7080520
|
data/app/models/spree/base.rb
CHANGED
@@ -1,28 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/preferences/persistable'
|
4
|
+
|
3
5
|
class Spree::Base < ActiveRecord::Base
|
4
|
-
include Spree::Preferences::Preferable
|
5
6
|
include Spree::Core::Permalinks
|
6
7
|
include Spree::RansackableAttributes
|
7
8
|
|
8
|
-
def
|
9
|
-
|
9
|
+
def self.preference(*args)
|
10
|
+
Spree::Deprecation.warn <<~WARN
|
11
|
+
#{name} has a `preferences` column, but does not explicitly (de)serialize this column.
|
12
|
+
In order to make #{name} work with future versions of Solidus (and Rails), please add the
|
13
|
+
following line to your class:
|
14
|
+
```
|
15
|
+
class #{name}
|
16
|
+
include Spree::Preferences::Persistable
|
17
|
+
...
|
18
|
+
end
|
19
|
+
```
|
20
|
+
WARN
|
21
|
+
include Spree::Preferences::Persistable
|
22
|
+
preference(*args)
|
10
23
|
end
|
11
24
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
25
|
+
def preferences
|
26
|
+
value = read_attribute(:preferences)
|
27
|
+
if !value.is_a?(Hash)
|
28
|
+
Spree::Deprecation.warn <<~WARN
|
29
|
+
#{self.class.name} has a `preferences` column, but does not explicitly (de)serialize this column.
|
30
|
+
In order to make #{self.class.name} work with future versions of Solidus (and Rails), please add the
|
31
|
+
following lines to your class:
|
32
|
+
```
|
33
|
+
class #{self.class.name}
|
34
|
+
include Spree::Preferences::Persistable
|
35
|
+
...
|
36
|
+
end
|
37
|
+
```
|
38
|
+
WARN
|
39
|
+
self.class.include Spree::Preferences::Persistable
|
17
40
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
super
|
41
|
+
ActiveRecord::Type::Serialized.new(
|
42
|
+
ActiveRecord::Type::Text.new,
|
43
|
+
ActiveRecord::Coders::YAMLColumn.new(:preferences, Hash)
|
44
|
+
).deserialize(value)
|
45
|
+
else
|
46
|
+
value
|
47
|
+
end
|
26
48
|
end
|
27
49
|
|
28
50
|
if Kaminari.config.page_method_name != :page
|
@@ -35,10 +57,6 @@ class Spree::Base < ActiveRecord::Base
|
|
35
57
|
end
|
36
58
|
end
|
37
59
|
|
38
|
-
def self.preferences_coder_class
|
39
|
-
Hash
|
40
|
-
end
|
41
|
-
|
42
60
|
self.abstract_class = true
|
43
61
|
|
44
62
|
# Provides a scope that should be included any time products
|
@@ -1,7 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/preferences/persistable'
|
4
|
+
|
3
5
|
module Spree
|
4
6
|
class Calculator < Spree::Base
|
7
|
+
include Spree::Preferences::Persistable
|
8
|
+
|
5
9
|
belongs_to :calculable, polymorphic: true, optional: true
|
6
10
|
|
7
11
|
# This method calls a compute_<computable> method. must be overriden in concrete calculator.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/preferences/persistable'
|
3
4
|
require 'spree/preferences/statically_configurable'
|
4
5
|
|
5
6
|
module Spree
|
@@ -11,6 +12,8 @@ module Spree
|
|
11
12
|
# This class is not meant to be instantiated. Please create instances of concrete payment methods.
|
12
13
|
#
|
13
14
|
class PaymentMethod < Spree::Base
|
15
|
+
include Spree::Preferences::Persistable
|
16
|
+
|
14
17
|
preference :server, :string, default: 'test'
|
15
18
|
preference :test_mode, :boolean, default: true
|
16
19
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/preferences/persistable'
|
4
|
+
|
3
5
|
module Spree
|
4
6
|
# Base class for all types of promotion action.
|
5
7
|
#
|
6
8
|
# PromotionActions perform the necessary tasks when a promotion is activated
|
7
9
|
# by an event and determined to be eligible.
|
8
10
|
class PromotionAction < Spree::Base
|
11
|
+
include Spree::Preferences::Persistable
|
9
12
|
include Spree::SoftDeletable
|
10
13
|
|
11
14
|
belongs_to :promotion, class_name: 'Spree::Promotion', inverse_of: :promotion_actions, optional: true
|
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'spree/preferences/persistable'
|
4
|
+
|
3
5
|
module Spree
|
4
6
|
# Base class for all promotion rules
|
5
7
|
class PromotionRule < Spree::Base
|
8
|
+
include Spree::Preferences::Persistable
|
9
|
+
|
6
10
|
belongs_to :promotion, class_name: 'Spree::Promotion', inverse_of: :promotion_rules, optional: true
|
7
11
|
|
8
12
|
scope :of_type, ->(type) { where(type: type) }
|
data/lib/spree/core/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module Preferences
|
5
|
+
module Persistable
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
include Spree::Preferences::Preferable
|
10
|
+
serialize :preferences, Hash
|
11
|
+
after_initialize :initialize_preference_defaults
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def initialize_preference_defaults
|
17
|
+
if has_attribute?(:preferences)
|
18
|
+
self.preferences = default_preferences.merge(preferences)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -829,6 +829,7 @@ files:
|
|
829
829
|
- lib/spree/permission_sets/user_management.rb
|
830
830
|
- lib/spree/permitted_attributes.rb
|
831
831
|
- lib/spree/preferences/configuration.rb
|
832
|
+
- lib/spree/preferences/persistable.rb
|
832
833
|
- lib/spree/preferences/preferable.rb
|
833
834
|
- lib/spree/preferences/preferable_class_methods.rb
|
834
835
|
- lib/spree/preferences/scoped_store.rb
|