store_model 1.6.0 → 1.6.1
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: f4731608dcbfcf457b9e0cce52d04766ccbc7ea38fc061a6af61ef3b6edc2a3c
|
4
|
+
data.tar.gz: d5a84b08a03420aece94ea78a0c620d3e486ac4046173d6b6091974f94f4c507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e78d0f1f95f9982ed599f5701e06d48936f2be349189764b5fa7df6fc7a0c9ee71a17d1ae50a74c1a70bcbb037feb8e33db43131de1e880efb74c9a2c0e9c9d
|
7
|
+
data.tar.gz: 7d5d82c70fe870f3abc767faae918a2a8f11bc6a9d645a8d36d12800da19951b9a8f018cdc336e5c35979a5e21847a034d1d9b76196a87c6bd1a1d0389062a80
|
@@ -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.1
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|