eac_rails_utils 0.28.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5a6e3872c396fa8b5f72890c2277ef32a0b01725ec73c46aae768b88404a577
4
- data.tar.gz: 67948ebeb31665af152aeed74a7ac149bc6e50103015382ed6aa4a0e6b7e2aa2
3
+ metadata.gz: 172baf3915f6863491a8c82492d93f1591ac20d0b9400e5bb7ec8cce1d2993ce
4
+ data.tar.gz: c289cf72d2bde93b1d121049bdbf4e765ae8446f94de8008c0fe2a4fb6c6cd9f
5
5
  SHA512:
6
- metadata.gz: 3083f6ab9d9a24ba98ea33edf9ae09cfc328a20134f9d75259c4ab5c65ff62ccd698758b1de7434f618ba3d7be4861f2246dcfcd9fe23d3080993d26d268a0b9
7
- data.tar.gz: 8dbb8e0d5d3de2ab4a63fce273845068a7e36cec60cbc9e2722f126ee468294bf51d7d3b5b94a812f0b4f746a852716db6e7735e43f31652248f4fa7380d0fe8
6
+ metadata.gz: 961730bc473c681d061eb388d18709df699203c5b67fd6ff59717195904265a4846c07781c0bbfb8a7d7b9ec86f8eba2390c41e7b66c620aba955755da5f202a
7
+ data.tar.gz: a3ce45f8730b4dd62531b1908d5a607052dee4650d62b16694aed969fa48ba15d5f42d324447cb496fb8a79b0692ab5d7891e94c7753fe7959daa6e7c6145414
@@ -12,14 +12,14 @@ module EacRailsUtils
12
12
 
13
13
  def collection
14
14
  extract_association_key(:collection, *(
15
- ::Rails.version < '5' ? [:all] : %i[klass all]
16
- ))
15
+ ::Rails.version < '5' ? [:all] : %i[klass all]
16
+ ))
17
17
  end
18
18
 
19
19
  def foreign_key
20
20
  extract_association_key(:foreign_key, (
21
- ::Rails.version < '5' ? :association_foreign_key : :join_foreign_key
22
- ))
21
+ ::Rails.version < '5' ? :association_foreign_key : :join_foreign_key
22
+ ))
23
23
  end
24
24
 
25
25
  def methods
@@ -20,7 +20,7 @@ module EacRailsUtils
20
20
 
21
21
  # @return [Hash]
22
22
  def tag_attributes
23
- column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h # rubocop:disable Style/HashTransformValues, Style/MapToHash
23
+ column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h # rubocop:disable Style/MapToHash
24
24
  end
25
25
  end
26
26
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module EacRailsUtils
4
4
  module DataTableHelper
5
- def data_table(dataset, &block)
6
- ::EacRailsUtils::DataTableHelper::DataTable.new(self, dataset, &block).output
5
+ def data_table(dataset, &)
6
+ ::EacRailsUtils::DataTableHelper::DataTable.new(self, dataset, &).output
7
7
  end
8
8
  end
9
9
  end
@@ -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[attribute] << (options[:message] || DEFAULT_MESSAGE) # rubocop:disable Rails/DeprecatedActiveModelErrorsMethods
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
@@ -9,7 +9,7 @@ module EacRailsUtils
9
9
 
10
10
  # @return [Symbol]
11
11
  def key
12
- path.map(&:to_s).join('_').to_sym
12
+ path.join('_').to_sym
13
13
  end
14
14
 
15
15
  # @param view [ActionView::Base]
@@ -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.keys.each do |column| # rubocop:disable Rails/DeprecatedActiveModelErrorsMethods, Style/HashEachMethods
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
- ActiveSupport::Dependencies.constantize(type_name)
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 = ActiveSupport::Dependencies.constantize(candidate)
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)
@@ -25,7 +25,7 @@ module EacRailsUtils
25
25
  end
26
26
 
27
27
  # define association like ActiveRecord
28
- def has_many(name, scope = nil, **options, &extension) # rubocop:disable Metrics/MethodLength, Naming/PredicatePrefix
28
+ def has_many(name, scope = nil, **options, &) # rubocop:disable Metrics/MethodLength, Naming/PredicatePrefix
29
29
  options.reverse_merge!(active_model: true, target_ids: "#{name.to_s.singularize}_ids")
30
30
  if scope.is_a?(Hash)
31
31
  options.merge!(scope)
@@ -33,7 +33,7 @@ module EacRailsUtils
33
33
  end
34
34
 
35
35
  reflection = EacRailsUtils::Models::TablelessAssociations::HasManyForActiveModel
36
- .build(self, name, scope, options, &extension)
36
+ .build(self, name, scope, options, &)
37
37
  ActiveRecord::Reflection.add_reflection self, name, reflection
38
38
 
39
39
  mixin = generated_association_methods
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsUtils
4
- VERSION = '0.28.0'
4
+ VERSION = '0.29.0'
5
5
  end
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.28.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-03-02 00:00:00.000000000 Z
11
+ date: 2026-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass
@@ -36,21 +36,24 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.130'
39
+ version: '0.131'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 0.131.2
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
- version: '0.130'
49
+ version: '0.131'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 0.131.2
47
53
  - !ruby/object:Gem::Dependency
48
- name: railties
54
+ name: rails
49
55
  requirement: !ruby/object:Gem::Requirement
50
56
  requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: 6.1.7
54
57
  - - ">="
55
58
  - !ruby/object:Gem::Version
56
59
  version: 6.1.7.10
@@ -58,9 +61,6 @@ dependencies:
58
61
  prerelease: false
59
62
  version_requirements: !ruby/object:Gem::Requirement
60
63
  requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: 6.1.7
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 6.1.7.10
@@ -105,6 +105,9 @@ dependencies:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0.12'
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 0.12.2
108
111
  type: :development
109
112
  prerelease: false
110
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -112,6 +115,9 @@ dependencies:
112
115
  - - "~>"
113
116
  - !ruby/object:Gem::Version
114
117
  version: '0.12'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 0.12.2
115
121
  description:
116
122
  email:
117
123
  executables: []
@@ -216,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
222
  requirements:
217
223
  - - ">="
218
224
  - !ruby/object:Gem::Version
219
- version: '2.7'
225
+ version: '3.2'
220
226
  required_rubygems_version: !ruby/object:Gem::Requirement
221
227
  requirements:
222
228
  - - ">="