eac_rails_utils 0.28.1 → 0.29.0
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/app/validators/eac_rails_utils/immutable_validator.rb +1 -1
- data/lib/eac_rails_utils/engine_helper.rb +13 -0
- data/lib/eac_rails_utils/models/fetch_errors.rb +1 -1
- data/lib/eac_rails_utils/models/tableless_associations/override_methods.rb +17 -2
- data/lib/eac_rails_utils/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 172baf3915f6863491a8c82492d93f1591ac20d0b9400e5bb7ec8cce1d2993ce
|
|
4
|
+
data.tar.gz: c289cf72d2bde93b1d121049bdbf4e765ae8446f94de8008c0fe2a4fb6c6cd9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 961730bc473c681d061eb388d18709df699203c5b67fd6ff59717195904265a4846c07781c0bbfb8a7d7b9ec86f8eba2390c41e7b66c620aba955755da5f202a
|
|
7
|
+
data.tar.gz: a3ce45f8730b4dd62531b1908d5a607052dee4650d62b16694aed969fa48ba15d5f42d324447cb496fb8a79b0692ab5d7891e94c7753fe7959daa6e7c6145414
|
|
@@ -8,7 +8,7 @@ module EacRailsUtils
|
|
|
8
8
|
return if record.new_record?
|
|
9
9
|
return unless record.send("#{attribute}_changed?")
|
|
10
10
|
|
|
11
|
-
record.errors
|
|
11
|
+
record.errors.add(attribute, options[:message] || DEFAULT_MESSAGE)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -10,11 +10,24 @@ module EacRailsUtils
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
common_concern do
|
|
13
|
+
append_after_initializers
|
|
13
14
|
append_autoload_paths
|
|
14
15
|
append_self_migrations
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
module ClassMethods
|
|
19
|
+
# Loads "config/after_initializers/*.rb" files deferred inside a
|
|
20
|
+
# "Rails.application.config.after_initialize" block, so their code can safely reference
|
|
21
|
+
# Zeitwerk-autoloaded constants (which are only available after the Finisher phase, i.e.
|
|
22
|
+
# too late for regular "config/initializers/*.rb" files).
|
|
23
|
+
def append_after_initializers
|
|
24
|
+
initializer :append_after_initializers do |app|
|
|
25
|
+
Dir["#{config.root}/config/after_initializers/*.rb"].each do |file|
|
|
26
|
+
app.config.after_initialize { load file }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
18
31
|
def append_autoload_paths
|
|
19
32
|
config.autoload_paths += Dir["#{config.root}/lib"]
|
|
20
33
|
end
|
|
@@ -10,7 +10,7 @@ module EacRailsUtils
|
|
|
10
10
|
# Um array de colunas pode ser passado em options[:skip] de colunas em record que não
|
|
11
11
|
# terão suas falhas adicionadas.
|
|
12
12
|
def fetch_record_errors(record, options = {})
|
|
13
|
-
record.errors.
|
|
13
|
+
record.errors.attribute_names.each do |column|
|
|
14
14
|
fetch_column_errors(record, column, column, options)
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -42,7 +42,7 @@ module EacRailsUtils
|
|
|
42
42
|
if type_name.match(/^::/)
|
|
43
43
|
# If the type is prefixed with a scope operator then we assume that
|
|
44
44
|
# the type_name is an absolute reference.
|
|
45
|
-
|
|
45
|
+
type_name.constantize
|
|
46
46
|
else
|
|
47
47
|
compute_type_from_candidates(type_name)
|
|
48
48
|
end
|
|
@@ -59,7 +59,7 @@ module EacRailsUtils
|
|
|
59
59
|
|
|
60
60
|
def compute_type_from_candidates(type_name)
|
|
61
61
|
compute_type_candidates(type_name).each do |candidate|
|
|
62
|
-
constant =
|
|
62
|
+
constant = candidate.constantize
|
|
63
63
|
return constant if candidate == constant.to_s
|
|
64
64
|
# We don't want to swallow NoMethodError < NameError errors
|
|
65
65
|
rescue NoMethodError
|
|
@@ -93,6 +93,21 @@ module EacRailsUtils
|
|
|
93
93
|
false
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
# dummy
|
|
97
|
+
def strict_loading?
|
|
98
|
+
false
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# dummy
|
|
102
|
+
def strict_loading_n_plus_one_only?
|
|
103
|
+
false
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# dummy
|
|
107
|
+
def strict_loading_mode
|
|
108
|
+
:all
|
|
109
|
+
end
|
|
110
|
+
|
|
96
111
|
private
|
|
97
112
|
|
|
98
113
|
def association_by_reflection(name)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eac_rails_utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.29.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- E.A.C.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bootstrap-sass
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
version: '0.131'
|
|
40
40
|
- - ">="
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: 0.131.
|
|
42
|
+
version: 0.131.2
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,7 +49,7 @@ dependencies:
|
|
|
49
49
|
version: '0.131'
|
|
50
50
|
- - ">="
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: 0.131.
|
|
52
|
+
version: 0.131.2
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: rails
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|