eac_rails_utils 0.27.0 → 0.28.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/lib/eac_rails_utils/engine.rb +11 -0
- data/lib/eac_rails_utils/rspec/setup.rb +1 -0
- data/lib/eac_rails_utils/version.rb +1 -1
- data/lib/eac_rails_utils.rb +0 -12
- metadata +12 -14
- data/lib/eac_rails_utils/menus.rb +0 -6
- data/lib/eac_rails_utils/models/tableless_associations/association_scope_extension.rb +0 -29
- data/lib/eac_rails_utils/models/tableless_associations/hooks.rb +0 -17
- data/lib/eac_rails_utils/models/tableless_associations/railtie.rb +0 -13
- data/lib/eac_rails_utils/models.rb +0 -6
- data/lib/eac_rails_utils/patches/active_model_associations.rb +0 -25
- data/lib/eac_rails_utils/patches/rails_5_2/active_model_association_method_fix.rb +0 -35
- data/lib/eac_rails_utils/patches/rails_5_2.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5a6e3872c396fa8b5f72890c2277ef32a0b01725ec73c46aae768b88404a577
|
|
4
|
+
data.tar.gz: 67948ebeb31665af152aeed74a7ac149bc6e50103015382ed6aa4a0e6b7e2aa2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3083f6ab9d9a24ba98ea33edf9ae09cfc328a20134f9d75259c4ab5c65ff62ccd698758b1de7434f618ba3d7be4861f2246dcfcd9fe23d3080993d26d268a0b9
|
|
7
|
+
data.tar.gz: 8dbb8e0d5d3de2ab4a63fce273845068a7e36cec60cbc9e2722f126ee468294bf51d7d3b5b94a812f0b4f746a852716db6e7735e43f31652248f4fa7380d0fe8
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'rails'
|
|
4
|
+
require 'action_view' # Fix "require 'nested_form_fields'"
|
|
5
|
+
require 'active_record'
|
|
6
|
+
require 'nested_form_fields'
|
|
7
|
+
require 'eac_ruby_utils'
|
|
8
|
+
require 'virtus'
|
|
9
|
+
|
|
10
|
+
require 'eac_rails_utils/engine_helper'
|
|
11
|
+
|
|
3
12
|
module EacRailsUtils
|
|
4
13
|
class Engine < ::Rails::Engine
|
|
5
14
|
include ::EacRailsUtils::EngineHelper
|
|
6
15
|
end
|
|
7
16
|
end
|
|
17
|
+
|
|
18
|
+
require 'eac_rails_utils/patches'
|
data/lib/eac_rails_utils.rb
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'eac_ruby_utils'
|
|
4
|
-
EacRubyUtils::RootModuleSetup.perform __FILE__ do
|
|
5
|
-
ignore 'patches'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
3
|
module EacRailsUtils
|
|
9
4
|
end
|
|
10
5
|
|
|
11
|
-
require 'rails'
|
|
12
|
-
require 'action_view' # Fix "require 'nested_form_fields'"
|
|
13
|
-
require 'active_record'
|
|
14
|
-
require 'nested_form_fields'
|
|
15
|
-
require 'virtus'
|
|
16
|
-
|
|
17
|
-
require 'eac_rails_utils/patches'
|
|
18
6
|
require 'eac_rails_utils/engine'
|
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.28.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-02
|
|
11
|
+
date: 2026-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bootstrap-sass
|
|
@@ -48,16 +48,22 @@ dependencies:
|
|
|
48
48
|
name: railties
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 6.1.7
|
|
51
54
|
- - ">="
|
|
52
55
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
56
|
+
version: 6.1.7.10
|
|
54
57
|
type: :runtime
|
|
55
58
|
prerelease: false
|
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
60
|
requirements:
|
|
61
|
+
- - "~>"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: 6.1.7
|
|
58
64
|
- - ">="
|
|
59
65
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
66
|
+
version: 6.1.7.10
|
|
61
67
|
- !ruby/object:Gem::Dependency
|
|
62
68
|
name: virtus
|
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -98,14 +104,14 @@ dependencies:
|
|
|
98
104
|
requirements:
|
|
99
105
|
- - "~>"
|
|
100
106
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0.
|
|
107
|
+
version: '0.12'
|
|
102
108
|
type: :development
|
|
103
109
|
prerelease: false
|
|
104
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
111
|
requirements:
|
|
106
112
|
- - "~>"
|
|
107
113
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0.
|
|
114
|
+
version: '0.12'
|
|
109
115
|
description:
|
|
110
116
|
email:
|
|
111
117
|
executables: []
|
|
@@ -171,11 +177,9 @@ files:
|
|
|
171
177
|
- lib/eac_rails_utils.rb
|
|
172
178
|
- lib/eac_rails_utils/engine.rb
|
|
173
179
|
- lib/eac_rails_utils/engine_helper.rb
|
|
174
|
-
- lib/eac_rails_utils/menus.rb
|
|
175
180
|
- lib/eac_rails_utils/menus/action.rb
|
|
176
181
|
- lib/eac_rails_utils/menus/group.rb
|
|
177
182
|
- lib/eac_rails_utils/menus/node.rb
|
|
178
|
-
- lib/eac_rails_utils/models.rb
|
|
179
183
|
- lib/eac_rails_utils/models/fetch_errors.rb
|
|
180
184
|
- lib/eac_rails_utils/models/inequality_queries.rb
|
|
181
185
|
- lib/eac_rails_utils/models/tableless.rb
|
|
@@ -185,23 +189,17 @@ files:
|
|
|
185
189
|
- lib/eac_rails_utils/models/tableless/strict_loading.rb
|
|
186
190
|
- lib/eac_rails_utils/models/tableless_associations.rb
|
|
187
191
|
- lib/eac_rails_utils/models/tableless_associations/active_record_reflection.rb
|
|
188
|
-
- lib/eac_rails_utils/models/tableless_associations/association_scope_extension.rb
|
|
189
192
|
- lib/eac_rails_utils/models/tableless_associations/autosave_association.rb
|
|
190
193
|
- lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model.rb
|
|
191
194
|
- lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model_association.rb
|
|
192
|
-
- lib/eac_rails_utils/models/tableless_associations/hooks.rb
|
|
193
195
|
- lib/eac_rails_utils/models/tableless_associations/initialize_extension.rb
|
|
194
196
|
- lib/eac_rails_utils/models/tableless_associations/override_methods.rb
|
|
195
|
-
- lib/eac_rails_utils/models/tableless_associations/railtie.rb
|
|
196
197
|
- lib/eac_rails_utils/models/test_utils.rb
|
|
197
198
|
- lib/eac_rails_utils/models/validations.rb
|
|
198
199
|
- lib/eac_rails_utils/patches.rb
|
|
199
200
|
- lib/eac_rails_utils/patches/active_model/naming.rb
|
|
200
|
-
- lib/eac_rails_utils/patches/active_model_associations.rb
|
|
201
201
|
- lib/eac_rails_utils/patches/application.rb
|
|
202
202
|
- lib/eac_rails_utils/patches/numeric/number_helper.rb
|
|
203
|
-
- lib/eac_rails_utils/patches/rails_5_2.rb
|
|
204
|
-
- lib/eac_rails_utils/patches/rails_5_2/active_model_association_method_fix.rb
|
|
205
203
|
- lib/eac_rails_utils/rspec.rb
|
|
206
204
|
- lib/eac_rails_utils/rspec/setup.rb
|
|
207
205
|
- lib/eac_rails_utils/rspec/setup/models_utils.rb
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacRailsUtils
|
|
4
|
-
module Models
|
|
5
|
-
module TablelessAssociations
|
|
6
|
-
module AssociationScopeExtension
|
|
7
|
-
if ActiveRecord.version >= Gem::Version.new('5.0.0.beta')
|
|
8
|
-
def add_constraints(scope, owner, association_klass, refl, chain_head, chain_tail) # rubocop:disable Metrics/ParameterLists
|
|
9
|
-
if refl.options[:active_model]
|
|
10
|
-
target_ids = refl.options[:target_ids]
|
|
11
|
-
return scope.where(id: owner[target_ids])
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
super
|
|
15
|
-
end
|
|
16
|
-
else
|
|
17
|
-
def add_constraints(scope, owner, assoc_klass, refl, tracker)
|
|
18
|
-
if refl.options[:active_model]
|
|
19
|
-
target_ids = refl.options[:target_ids]
|
|
20
|
-
return scope.where(id: owner[target_ids])
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
super
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacRailsUtils
|
|
4
|
-
module Models
|
|
5
|
-
module TablelessAssociations
|
|
6
|
-
module Hooks
|
|
7
|
-
def self.init
|
|
8
|
-
ActiveSupport.on_load(:active_record) do
|
|
9
|
-
ActiveRecord::Associations::AssociationScope.prepend(
|
|
10
|
-
EacRailsUtils::Models::TablelessAssociations::AssociationScopeExtension
|
|
11
|
-
)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacRailsUtils
|
|
4
|
-
module Models
|
|
5
|
-
module TablelessAssociations
|
|
6
|
-
class Railtie < ::Rails::Railtie # :nodoc:
|
|
7
|
-
initializer 'activemodel-associations' do |_|
|
|
8
|
-
EacRailsUtils::Models::TablelessAssociations::Hooks.init
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacRailsUtils
|
|
4
|
-
module Models
|
|
5
|
-
module TablelessAssociations
|
|
6
|
-
module Hooks
|
|
7
|
-
class << self
|
|
8
|
-
def init
|
|
9
|
-
init_rails_5_2 if ::EacRailsUtils::Patches::Rails52.enabled?
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def init_rails_5_2 # rubocop:disable Naming/VariableNumber
|
|
13
|
-
rails_5_2_fix_activemodel_associations_methods
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def rails_5_2_fix_activemodel_associations_methods
|
|
17
|
-
%i[belongs_to has_many].each do |method|
|
|
18
|
-
::EacRailsUtils::Patches::Rails52::ActiveModelAssociationMethodFix.new(method)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module EacRailsUtils
|
|
4
|
-
module Patches
|
|
5
|
-
module Rails52
|
|
6
|
-
class ActiveModelAssociationMethodFix
|
|
7
|
-
common_constructor :method_name do
|
|
8
|
-
perform
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def original_method_new_name
|
|
12
|
-
:"original_#{method_name}"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
def the_module
|
|
18
|
-
::EacRailsUtils::Models::TablelessAssociations::ClassMethods
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def perform
|
|
22
|
-
patch = self
|
|
23
|
-
the_module.class_eval do
|
|
24
|
-
alias_method patch.original_method_new_name, patch.method_name
|
|
25
|
-
remove_method patch.method_name
|
|
26
|
-
|
|
27
|
-
define_method patch.method_name do |name, scope = nil, **options, &extension|
|
|
28
|
-
send(patch.original_method_new_name, name, scope, options, &extension)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|