eac_rails_utils 0.27.0 → 0.28.1
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/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb +4 -4
- data/app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb +1 -1
- data/app/helpers/eac_rails_utils/data_table_helper.rb +2 -2
- data/lib/eac_rails_utils/engine.rb +11 -0
- data/lib/eac_rails_utils/menus/action.rb +1 -1
- data/lib/eac_rails_utils/models/tableless_associations.rb +2 -2
- 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 +22 -18
- 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: ec8b109e0c6e66d5becb0aef1acf93b5fb5c44064585cbfe84fc582265da3c42
|
|
4
|
+
data.tar.gz: 7db6bbecd1c9e8af9f93f91e547fd8966d2a5d6c1fc553131d690ee9e753ddad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f09bfc73b3c3754897bdc3b380cb80249ebd91d9300d05c4ba61a047b16f13b9f0c8f62268a15c67f365ee6982c7cca635b956bcd2d226bb6ca32dc8b9d0bbce
|
|
7
|
+
data.tar.gz: 2e4f6018993f20cd2a698ec1185cf7a8add3e09a84c76a25ad0263fa0f6df4c53afb0e57eb1f7a00655ee0f500874f60bf75a6064e70106729be7b76c48e1810
|
data/app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb
CHANGED
|
@@ -12,14 +12,14 @@ module EacRailsUtils
|
|
|
12
12
|
|
|
13
13
|
def collection
|
|
14
14
|
extract_association_key(:collection, *(
|
|
15
|
-
|
|
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
|
-
|
|
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/
|
|
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, &
|
|
6
|
-
::EacRailsUtils::DataTableHelper::DataTable.new(self, dataset, &
|
|
5
|
+
def data_table(dataset, &)
|
|
6
|
+
::EacRailsUtils::DataTableHelper::DataTable.new(self, dataset, &).output
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -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'
|
|
@@ -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, &
|
|
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, &
|
|
36
|
+
.build(self, name, scope, options, &)
|
|
37
37
|
ActiveRecord::Reflection.add_reflection self, name, reflection
|
|
38
38
|
|
|
39
39
|
mixin = generated_association_methods
|
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.1
|
|
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-
|
|
11
|
+
date: 2026-07-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bootstrap-sass
|
|
@@ -36,28 +36,34 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0.
|
|
39
|
+
version: '0.131'
|
|
40
|
+
- - ">="
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 0.131.1
|
|
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.
|
|
49
|
+
version: '0.131'
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 0.131.1
|
|
47
53
|
- !ruby/object:Gem::Dependency
|
|
48
|
-
name:
|
|
54
|
+
name: rails
|
|
49
55
|
requirement: !ruby/object:Gem::Requirement
|
|
50
56
|
requirements:
|
|
51
57
|
- - ">="
|
|
52
58
|
- !ruby/object:Gem::Version
|
|
53
|
-
version:
|
|
59
|
+
version: 6.1.7.10
|
|
54
60
|
type: :runtime
|
|
55
61
|
prerelease: false
|
|
56
62
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
63
|
requirements:
|
|
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,20 @@ dependencies:
|
|
|
98
104
|
requirements:
|
|
99
105
|
- - "~>"
|
|
100
106
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0.
|
|
107
|
+
version: '0.12'
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 0.12.2
|
|
102
111
|
type: :development
|
|
103
112
|
prerelease: false
|
|
104
113
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
114
|
requirements:
|
|
106
115
|
- - "~>"
|
|
107
116
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0.
|
|
117
|
+
version: '0.12'
|
|
118
|
+
- - ">="
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: 0.12.2
|
|
109
121
|
description:
|
|
110
122
|
email:
|
|
111
123
|
executables: []
|
|
@@ -171,11 +183,9 @@ files:
|
|
|
171
183
|
- lib/eac_rails_utils.rb
|
|
172
184
|
- lib/eac_rails_utils/engine.rb
|
|
173
185
|
- lib/eac_rails_utils/engine_helper.rb
|
|
174
|
-
- lib/eac_rails_utils/menus.rb
|
|
175
186
|
- lib/eac_rails_utils/menus/action.rb
|
|
176
187
|
- lib/eac_rails_utils/menus/group.rb
|
|
177
188
|
- lib/eac_rails_utils/menus/node.rb
|
|
178
|
-
- lib/eac_rails_utils/models.rb
|
|
179
189
|
- lib/eac_rails_utils/models/fetch_errors.rb
|
|
180
190
|
- lib/eac_rails_utils/models/inequality_queries.rb
|
|
181
191
|
- lib/eac_rails_utils/models/tableless.rb
|
|
@@ -185,23 +195,17 @@ files:
|
|
|
185
195
|
- lib/eac_rails_utils/models/tableless/strict_loading.rb
|
|
186
196
|
- lib/eac_rails_utils/models/tableless_associations.rb
|
|
187
197
|
- lib/eac_rails_utils/models/tableless_associations/active_record_reflection.rb
|
|
188
|
-
- lib/eac_rails_utils/models/tableless_associations/association_scope_extension.rb
|
|
189
198
|
- lib/eac_rails_utils/models/tableless_associations/autosave_association.rb
|
|
190
199
|
- lib/eac_rails_utils/models/tableless_associations/has_many_for_active_model.rb
|
|
191
200
|
- 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
201
|
- lib/eac_rails_utils/models/tableless_associations/initialize_extension.rb
|
|
194
202
|
- lib/eac_rails_utils/models/tableless_associations/override_methods.rb
|
|
195
|
-
- lib/eac_rails_utils/models/tableless_associations/railtie.rb
|
|
196
203
|
- lib/eac_rails_utils/models/test_utils.rb
|
|
197
204
|
- lib/eac_rails_utils/models/validations.rb
|
|
198
205
|
- lib/eac_rails_utils/patches.rb
|
|
199
206
|
- lib/eac_rails_utils/patches/active_model/naming.rb
|
|
200
|
-
- lib/eac_rails_utils/patches/active_model_associations.rb
|
|
201
207
|
- lib/eac_rails_utils/patches/application.rb
|
|
202
208
|
- 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
209
|
- lib/eac_rails_utils/rspec.rb
|
|
206
210
|
- lib/eac_rails_utils/rspec/setup.rb
|
|
207
211
|
- lib/eac_rails_utils/rspec/setup/models_utils.rb
|
|
@@ -218,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
218
222
|
requirements:
|
|
219
223
|
- - ">="
|
|
220
224
|
- !ruby/object:Gem::Version
|
|
221
|
-
version: '2
|
|
225
|
+
version: '3.2'
|
|
222
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
227
|
requirements:
|
|
224
228
|
- - ">="
|
|
@@ -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
|