eac_rails_utils 0.23.1 → 0.23.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/app/helpers/eac_rails_utils/data_table_helper/column.rb +1 -1
- data/app/helpers/eac_rails_utils/data_table_helper/data_table/value_cell.rb +1 -1
- data/app/helpers/eac_rails_utils/menus_helper.rb +1 -1
- data/app/helpers/eac_rails_utils/open_graph_protocol_helper.rb +2 -2
- data/config/initializers/json.rb +3 -3
- data/lib/active_record/associations/builder/has_many_for_active_model.rb +11 -11
- data/lib/active_record/associations/has_many_for_active_model_association.rb +1 -1
- data/lib/activemodel/associations.rb +7 -9
- data/lib/eac_rails_utils/engine_helper.rb +1 -1
- data/lib/eac_rails_utils/models/fetch_errors.rb +2 -2
- data/lib/eac_rails_utils/models/tableless/build_attributes.rb +1 -1
- data/lib/eac_rails_utils/models/tableless_associations/override_methods.rb +3 -1
- data/lib/eac_rails_utils/models/tableless_associations.rb +1 -1
- data/lib/eac_rails_utils/patches/active_model.rb +1 -1
- data/lib/eac_rails_utils/patches/numeric.rb +1 -1
- data/lib/eac_rails_utils/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf8f49e079ac5907ff3b0bf020231e2b35e5e8b0a2167b0c7dd6267366973e20
|
4
|
+
data.tar.gz: ab0167ce99e19ed9625e43de6587c3bd3949f5ff8b6a35bdeb3513e56b5eaba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58061deb5e323692139ef7930a26e9625c89f384b41e8bbc8a903637a5533b24d93bd177865b905fb9478162ac6838ae2a7c37f47cd3fa15ed5518ea5bd57e0e
|
7
|
+
data.tar.gz: 4cc872c05aca276bfb9f4a3337a43f7c6c953b40b5282fc48fd78f47cccc6b03d80c5409fcf8b3a06080f6cc3fad939136ea0f29bda50144729b50ae764ce2f0
|
@@ -22,7 +22,7 @@ module EacRailsUtils
|
|
22
22
|
|
23
23
|
# @return [Hash]
|
24
24
|
def tag_attributes
|
25
|
-
column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h
|
25
|
+
column.value_cell_attributes.map { |k, v| [k, tag_attribute_value(v)] }.to_h # rubocop:disable Style/HashTransformValues, Style/MapToHash
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -12,7 +12,7 @@ module EacRailsUtils
|
|
12
12
|
|
13
13
|
id = SecureRandom.hex(5)
|
14
14
|
GuiBuilder.new(self).build(entries, id: id, class: 'jMenu') <<
|
15
|
-
javascript_tag("$(document).ready(function(){$('
|
15
|
+
javascript_tag("$(document).ready(function(){$('##{id}').jMenu();});")
|
16
16
|
end
|
17
17
|
|
18
18
|
def bootstrap_dropdown_menu(entries, options = {})
|
@@ -39,7 +39,7 @@ module EacRailsUtils
|
|
39
39
|
def children_tags
|
40
40
|
view.capture do
|
41
41
|
view.concat tag
|
42
|
-
@children.values.each do |child| # rubocop:disable Rails/HelperInstanceVariable
|
42
|
+
@children.values.each do |child| # rubocop:disable Rails/HelperInstanceVariable, Style/HashEachMethods
|
43
43
|
view.concat(child.children_tags)
|
44
44
|
view.concat("\n")
|
45
45
|
end
|
@@ -59,7 +59,7 @@ module EacRailsUtils
|
|
59
59
|
attr_reader :parent, :suffix
|
60
60
|
|
61
61
|
def initialize(view, parent, suffix)
|
62
|
-
super
|
62
|
+
super(view)
|
63
63
|
@parent = parent # rubocop:disable Rails/HelperInstanceVariable
|
64
64
|
@suffix = suffix # rubocop:disable Rails/HelperInstanceVariable
|
65
65
|
end
|
data/config/initializers/json.rb
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
def patch_json?
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
rescue
|
6
|
+
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7') &&
|
7
|
+
Gem::Version.new(JSON::VERSION) < Gem::Version.new('2')
|
8
|
+
rescue LoadError
|
9
9
|
false
|
10
10
|
end
|
11
11
|
|
@@ -1,23 +1,23 @@
|
|
1
|
-
module ActiveRecord::Associations::Builder
|
1
|
+
module ActiveRecord::Associations::Builder # rubocop:disable Style/ClassAndModuleChildren, Style/FrozenStringLiteralComment
|
2
2
|
class HasManyForActiveModel < HasMany
|
3
|
-
if ActiveRecord.version >= Gem::Version.new(
|
4
|
-
AR_CALLBACK_METHODS = %i
|
5
|
-
after_save before_update after_update
|
3
|
+
if ActiveRecord.version >= Gem::Version.new('5.0.0.beta')
|
4
|
+
AR_CALLBACK_METHODS = %i[define_callback before_validation after_validation before_save
|
5
|
+
after_save before_update after_update].freeze
|
6
6
|
|
7
7
|
def self.valid_options(_options)
|
8
|
-
super + [
|
9
|
-
|
8
|
+
super + %i[active_model
|
9
|
+
target_ids] - %i[through dependent source source_type counter_cache as]
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.define_callbacks(model, reflection)
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
return unless AR_CALLBACK_METHODS.all? { |meth| respond_to?(meth) }
|
14
|
+
|
15
|
+
super
|
16
16
|
end
|
17
17
|
else
|
18
18
|
def valid_options
|
19
|
-
super + [
|
20
|
-
|
19
|
+
super + %i[active_model
|
20
|
+
target_ids] - %i[through dependent source source_type counter_cache as]
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ActiveRecord::Associations
|
1
|
+
module ActiveRecord::Associations # rubocop:disable Style/ClassAndModuleChildren, Style/FrozenStringLiteralComment
|
2
2
|
class HasManyForActiveModelAssociation < HasManyAssociation
|
3
3
|
# remove conditions: owner.new_record?, foreign_key_present?
|
4
4
|
def find_target?
|
@@ -1,15 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'active_model' # rubocop:disable Style/FrozenStringLiteralComment
|
2
|
+
require 'active_record'
|
3
|
+
require 'active_support'
|
4
|
+
require 'eac_rails_utils/models/tableless_associations'
|
5
|
+
require 'eac_rails_utils/models/tableless_associations/hooks'
|
6
6
|
|
7
7
|
# Load Railtie
|
8
8
|
begin
|
9
|
-
require
|
9
|
+
require 'rails'
|
10
10
|
rescue LoadError # rubocop:disable Lint/SuppressedException
|
11
11
|
end
|
12
12
|
|
13
|
-
if defined?(Rails)
|
14
|
-
require "eac_rails_utils/models/tableless_associations/railtie"
|
15
|
-
end
|
13
|
+
require 'eac_rails_utils/models/tableless_associations/railtie' if defined?(Rails)
|
@@ -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
|
13
|
+
record.errors.keys.each do |column| # rubocop:disable Rails/DeprecatedActiveModelErrorsMethods, Style/HashEachMethods
|
14
14
|
fetch_column_errors(record, column, column, options)
|
15
15
|
end
|
16
16
|
end
|
@@ -83,7 +83,7 @@ module EacRailsUtils
|
|
83
83
|
b = ''
|
84
84
|
errors.messages.each do |field, messages|
|
85
85
|
b += ' / ' if b != ''
|
86
|
-
b += field.to_s + ': ' + messages.to_s
|
86
|
+
b += field.to_s + ': ' + messages.to_s # rubocop:disable Style/StringConcatenation
|
87
87
|
end
|
88
88
|
b
|
89
89
|
end
|
@@ -32,7 +32,7 @@ module EacRailsUtils
|
|
32
32
|
m = /\A(.+)\(([0-9]+)(.)\)\z/.match(key)
|
33
33
|
return unless m
|
34
34
|
|
35
|
-
::OpenStruct.new(key: m[1], index: m[2].to_i - 1, converter: array_value_converter(m[3]))
|
35
|
+
::OpenStruct.new(key: m[1], index: m[2].to_i - 1, converter: array_value_converter(m[3])) # rubocop:disable Style/OpenStructUse
|
36
36
|
end
|
37
37
|
|
38
38
|
def array_value_set(array_attr, value)
|
@@ -50,7 +50,9 @@ module EacRailsUtils
|
|
50
50
|
# Build a list of candidates to search for
|
51
51
|
def compute_type_candidates(type_name)
|
52
52
|
candidates = []
|
53
|
-
name.scan(/::|$/)
|
53
|
+
name.scan(/::|$/) do
|
54
|
+
candidates.unshift "#{::Regexp.last_match.pre_match}::#{type_name}"
|
55
|
+
end
|
54
56
|
candidates << type_name
|
55
57
|
end
|
56
58
|
|
@@ -43,7 +43,7 @@ module EacRailsUtils
|
|
43
43
|
ActiveRecord::Reflection.add_reflection self, name, reflection
|
44
44
|
|
45
45
|
mixin = generated_association_methods
|
46
|
-
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
46
|
+
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1 # rubocop:disable Style/DocumentDynamicEvalDefinition
|
47
47
|
def #{options[:target_ids]}=(other_ids)
|
48
48
|
@#{options[:target_ids]} = other_ids
|
49
49
|
association(:#{name}).reset
|
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.23.
|
4
|
+
version: 0.23.3
|
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: 2024-04-
|
11
|
+
date: 2024-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap-sass
|
@@ -99,6 +99,9 @@ dependencies:
|
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0.10'
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.10.1
|
102
105
|
type: :development
|
103
106
|
prerelease: false
|
104
107
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,6 +109,9 @@ dependencies:
|
|
106
109
|
- - "~>"
|
107
110
|
- !ruby/object:Gem::Version
|
108
111
|
version: '0.10'
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 0.10.1
|
109
115
|
description:
|
110
116
|
email:
|
111
117
|
executables: []
|