store_model 1.6.0 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccb71e398694ddaf5061f4088a8172ec4c6df21e42934dc160d393948ed59882
|
4
|
+
data.tar.gz: efe5e68f750c0bb31ef030de7a7a01f761f7c03b95875dd78dba95256fe7e0fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f3624df6d013c1927eedcea35ef8c4abc1cfc95c4312a72af8d83d1e5e88f910527ca0ebdab99fce8db004e621dfc38f6b61e02abd3e684aea2c6d5615c334
|
7
|
+
data.tar.gz: 6811e01828fb9c9464513793e369bb436c48cb9adb23d2a4b01ef59d21e7a97e8353f9b4493f64e8a711e8388c3cc59f6e6bcf376b1d133d81b9dbd440dd6034
|
@@ -22,20 +22,21 @@ module ActiveModel
|
|
22
22
|
|
23
23
|
case record.type_for_attribute(attribute).type
|
24
24
|
when :json, :polymorphic
|
25
|
-
call_json_strategy(
|
25
|
+
call_json_strategy(record, attribute, value)
|
26
26
|
when :array, :polymorphic_array
|
27
|
-
call_array_strategy(
|
27
|
+
call_array_strategy(record, attribute, value)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
def call_json_strategy(
|
34
|
-
strategy.call(attribute,
|
33
|
+
def call_json_strategy(record, attribute, value)
|
34
|
+
strategy.call(attribute, record.errors, value.errors) if value.invalid?(record.validation_context)
|
35
35
|
end
|
36
36
|
|
37
|
-
def call_array_strategy(
|
38
|
-
|
37
|
+
def call_array_strategy(record, attribute, value)
|
38
|
+
any_invalid = value.select { |v| v.invalid?(record.validation_context) }.present?
|
39
|
+
array_strategy.call(attribute, record.errors, value) if any_invalid
|
39
40
|
end
|
40
41
|
|
41
42
|
def strategy
|
data/lib/store_model/enum.rb
CHANGED
@@ -46,7 +46,6 @@ module StoreModel
|
|
46
46
|
|
47
47
|
def define_map_readers(name, mapping)
|
48
48
|
define_method("#{name}_values") { mapping }
|
49
|
-
alias_method(ActiveSupport::Inflector.pluralize(name), "#{name}_values")
|
50
49
|
singleton_class.define_method("#{name}_values") { mapping }
|
51
50
|
singleton_class.alias_method(ActiveSupport::Inflector.pluralize(name), "#{name}_values")
|
52
51
|
end
|
data/lib/store_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: store_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|