xsdk-scaffold-rails 0.1.4.1 → 0.1.4.3
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.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +15 -13
- data/lib/xsdk/scaffold/rails.rb +1 -0
- data/lib/xsdk/scaffold/rails/errors.rb +24 -21
- data/lib/xsdk/scaffold/rails/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8137485ac88425560227d41abc1616a13a7a1868e7b9663ea0b3161f6b6b9e37
|
4
|
+
data.tar.gz: dc8f81e0ea31be00347837417e1ce3ae666a602b83e7f7fb528763cc568fd52f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac50a6a9ef3b080ea7ab2e183645d87a42f2e2573bbe876051e5ae8624d137966405b048b93ce59741aed06d9f9a7e348dd481f3a46545e8cf2a17308f39014f
|
7
|
+
data.tar.gz: 52d2f9c5dcf6da229d90a97f7adf4f720a4f3db3e55d13bcc33585479eef50c490cc0219537f9cf1e584a981042bbd5ef4453257ca062f3c2df02e45c14f6b27
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
xsdk-scaffold-rails
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-3.0.0
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
xsdk-scaffold-rails (0.1.4.
|
4
|
+
xsdk-scaffold-rails (0.1.4.3)
|
5
5
|
activerecord (>= 6.0.0)
|
6
6
|
pg (>= 1.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (6.
|
12
|
-
activesupport (= 6.
|
13
|
-
activerecord (6.
|
14
|
-
activemodel (= 6.
|
15
|
-
activesupport (= 6.
|
16
|
-
activesupport (6.
|
11
|
+
activemodel (6.0.3.6)
|
12
|
+
activesupport (= 6.0.3.6)
|
13
|
+
activerecord (6.0.3.6)
|
14
|
+
activemodel (= 6.0.3.6)
|
15
|
+
activesupport (= 6.0.3.6)
|
16
|
+
activesupport (6.0.3.6)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (>=
|
19
|
-
minitest (
|
20
|
-
tzinfo (~>
|
21
|
-
zeitwerk (~> 2.
|
18
|
+
i18n (>= 0.7, < 2)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
22
22
|
ast (2.4.2)
|
23
23
|
concurrent-ruby (1.1.8)
|
24
24
|
diff-lcs (1.4.4)
|
@@ -64,12 +64,14 @@ GEM
|
|
64
64
|
rubocop (~> 1.0)
|
65
65
|
rubocop-ast (>= 1.1.0)
|
66
66
|
ruby-progressbar (1.11.0)
|
67
|
-
|
68
|
-
|
67
|
+
thread_safe (0.3.6)
|
68
|
+
tzinfo (1.2.9)
|
69
|
+
thread_safe (~> 0.1)
|
69
70
|
unicode-display_width (1.7.0)
|
70
71
|
zeitwerk (2.4.2)
|
71
72
|
|
72
73
|
PLATFORMS
|
74
|
+
ruby
|
73
75
|
x86_64-darwin-20
|
74
76
|
|
75
77
|
DEPENDENCIES
|
data/lib/xsdk/scaffold/rails.rb
CHANGED
@@ -1,31 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Xsdk
|
3
|
+
module Scaffold
|
4
|
+
module Rails
|
5
|
+
module Errors
|
6
|
+
extend ActiveSupport::Concern
|
3
7
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
local_errors.delete(name_assoc)
|
15
|
-
model_assoc = send(name_assoc)
|
16
|
-
next if model_assoc.nil?
|
8
|
+
def errors
|
9
|
+
local_errors = super()
|
10
|
+
keys = self.class.reflect_on_all_associations.select do |assoc|
|
11
|
+
self.class.nested_attributes_options.key? assoc.name
|
12
|
+
end
|
13
|
+
keys.each do |assoc|
|
14
|
+
name_assoc = assoc.name
|
15
|
+
local_errors.delete(name_assoc)
|
16
|
+
model_assoc = send(name_assoc)
|
17
|
+
next if model_assoc.nil?
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
row_errors = {}
|
20
|
+
if assoc.macro == :belongs_to
|
21
|
+
row_errors[model_assoc._uuid] = model_assoc.errors.messages if model_assoc.errors.messages.keys.any?
|
22
|
+
else
|
23
|
+
model_assoc.each do |row|
|
24
|
+
row_errors[row._uuid] = row.errors.messages if row.errors.messages.keys.any?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
local_errors.add(name_assoc, row_errors) if row_errors.keys.any?
|
24
28
|
end
|
29
|
+
local_errors
|
25
30
|
end
|
26
|
-
local_errors.add(name_assoc, row_errors) if row_errors.keys.any?
|
27
31
|
end
|
28
|
-
local_errors
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xsdk-scaffold-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.4.
|
4
|
+
version: 0.1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davide Croci
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -90,6 +90,8 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
92
|
- ".rubocop.yml"
|
93
|
+
- ".ruby-gemset"
|
94
|
+
- ".ruby-version"
|
93
95
|
- ".travis.yml"
|
94
96
|
- Gemfile
|
95
97
|
- Gemfile.lock
|