adaptive_alias 1.1.1 → 1.2.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: 2557ac5e97d02789b75b5468e51f3b67d677195cd90111416222bba40d47b79c
4
- data.tar.gz: 54561a2436419e0dec856da7d678e3c01dfb437d6642ee3dc5a162492b848a54
3
+ metadata.gz: ea9cff7fa278b8d8a4fcb07a8acb7cca4e9fc11edea3540314c82f8e8f7bd4c4
4
+ data.tar.gz: 24e34e5bc93827011bc36414cee5513b7ebda21e980b61e282c053436b8b917f
5
5
  SHA512:
6
- metadata.gz: 68b69b12d2f60509dc9c014d684727f688e57d87cd2baf612ba9cfa4e7efaa7b2e10ec05ecd60d1e83a9c547e4c6f896f816bc529b490ebb8f1a1e76888a5fd1
7
- data.tar.gz: 90e873a39c890cacea169226ca33a78b404d347aa5a238a793e2a753e61d7b43a46507ea52f50b467ac45fbc923f8135e8b60cd3a4763f1061e20ab94c69aecf
6
+ metadata.gz: 64fc033de6ab1add5e4bcba89e80bdc4d9c0720856593389ee4802db36890b4a685e153a3629766c5bda34c008ef744283d7b0e8951d82c1240c6863a2fd4edd
7
+ data.tar.gz: d01042b8f6871039a1d448794c596ebc86fd1a7df867aa7bb570d61d6be04ed547b82c478b731d9febd6c006d7075cf276b306f023c6ac760f0cf3e50e8d388c
data/CHANGELOG.md CHANGED
@@ -1,45 +1,52 @@
1
- ## Change Log
2
-
3
- ### [v1.1.0](https://github.com/khiav223577/adaptive_alias/compare/v1.0.0...v1.1.0) 2022/09/27
4
- - [#22](https://github.com/khiav223577/adaptive_alias/pull/22) [Fix] creation via autosave(belongs_to) association (@khiav223577)
5
-
6
- ### [v1.0.0](https://github.com/khiav223577/adaptive_alias/compare/v0.2.4...v1.0.0) 2022/09/22
7
- - [#21](https://github.com/khiav223577/adaptive_alias/pull/21) [Fix] Model with ignored_columns or calling find_by directly on model class with aliased column argument will fail (@khiav223577)
8
- - [#20](https://github.com/khiav223577/adaptive_alias/pull/20) [Fix] Problems with STI classes and models that uses same table name (@khiav223577)
9
- - [#19](https://github.com/khiav223577/adaptive_alias/pull/19) [Fix] Rescue the error when doing direct access to target table's field (@khiav223577)
10
-
11
- ### [v0.2.4](https://github.com/khiav223577/adaptive_alias/compare/v0.2.3...v0.2.4) 2022/08/18
12
- - [#18](https://github.com/khiav223577/adaptive_alias/pull/18) [Fix] Get model from a relation with join will not generate right query (after migration) (@khiav223577)
13
-
14
- ### [v0.2.3](https://github.com/khiav223577/adaptive_alias/compare/v0.2.2...v0.2.3) 2022/08/17
15
- - [#17](https://github.com/khiav223577/adaptive_alias/pull/17) [Feature] Support joins (@khiav223577)
16
- - [#16](https://github.com/khiav223577/adaptive_alias/pull/16) [Enhance] No need to clone node (@khiav223577)
17
- - [#15](https://github.com/khiav223577/adaptive_alias/pull/15) [Test] Add test cases to test calling pluck on same model (@khiav223577)
18
-
19
- ### [v0.2.2](https://github.com/khiav223577/adaptive_alias/compare/v0.2.1...v0.2.2) 2022/08/11
20
- - [#14](https://github.com/khiav223577/adaptive_alias/pull/14) [Fix] Fail to use backward-patch when target column has already been migrated (@khiav223577)
21
-
22
- ### [v0.2.1](https://github.com/khiav223577/adaptive_alias/compare/v0.2.0...v0.2.1) 2022/08/11
23
- - [#13](https://github.com/khiav223577/adaptive_alias/pull/13) [Fix] Nested module include is not supported until ruby 3.0 (@khiav223577)
24
- - [#12](https://github.com/khiav223577/adaptive_alias/pull/12) [Test] Add test cases to test column_names (@khiav223577)
25
-
26
- ### [v0.2.0](https://github.com/khiav223577/adaptive_alias/compare/v0.1.0...v0.2.0) 2022/08/05
27
- - [#11](https://github.com/khiav223577/adaptive_alias/pull/11) [Feature] Support polymorphic (@khiav223577)
28
- - [#10](https://github.com/khiav223577/adaptive_alias/pull/10) [Enhance] Prevent adding methods directly in class / module (@khiav223577)
29
- - [#9](https://github.com/khiav223577/adaptive_alias/pull/9) [Enhance] Prevent changing original order of where conditions (@khiav223577)
30
- - [#8](https://github.com/khiav223577/adaptive_alias/pull/8) [Test] Make sure we are reset to use original patch when some test cases fail (@khiav223577)
31
- - [#7](https://github.com/khiav223577/adaptive_alias/pull/7) [Test] Add test cases to test destroy (@khiav223577)
32
-
33
- ### [v0.1.0](https://github.com/khiav223577/adaptive_alias/compare/v0.0.3...v0.1.0) 2022/08/01
34
- - [#6](https://github.com/khiav223577/adaptive_alias/pull/6) [Feature] Deal with creating records (@khiav223577)
35
- - [#5](https://github.com/khiav223577/adaptive_alias/pull/5) [Enhance] Prevent infinite loop if something went wrong (@khiav223577)
36
- - [#4](https://github.com/khiav223577/adaptive_alias/pull/4) [Fix] Attributes writer method should be defined after schema changes (@khiav223577)
37
-
38
- ### [v0.0.3](https://github.com/khiav223577/adaptive_alias/compare/v0.0.2...v0.0.3) 2022/07/27
39
- - [#3](https://github.com/khiav223577/adaptive_alias/pull/3) [Fix] Prevent calling custom column names from raising missing attributes (@khiav223577)
40
-
41
- ### [v0.0.2](https://github.com/khiav223577/adaptive_alias/compare/v0.0.1...v0.0.2) 2022/07/26
42
- - [#2](https://github.com/khiav223577/adaptive_alias/pull/2) [Enhance] Doesn't need rails_compatibility in runtime (@khiav223577)
43
-
44
- ### v0.0.1 2022/07/22
45
- - [#1](https://github.com/khiav223577/adaptive_alias/pull/1) [Feature] Implement adaptive_alias features (@khiav223577)
1
+ ## Change Log
2
+
3
+ ### [v1.1.2](https://github.com/khiav223577/adaptive_alias/compare/v1.1.1...v1.1.2) 2022/10/11
4
+ - [#25](https://github.com/khiav223577/adaptive_alias/pull/25) [Fix] Deal with count, sum, and group (@khiav223577)
5
+
6
+ ### [v1.1.1](https://github.com/khiav223577/adaptive_alias/compare/v1.1.0...v1.1.1) 2022/10/07
7
+ - [#24](https://github.com/khiav223577/adaptive_alias/pull/24) [Fix] Disappeared value when instantiating all and then create / update multiple models one by one (@khiav223577)
8
+ - [#23](https://github.com/khiav223577/adaptive_alias/pull/23) [Enhance] No need to determine missing value manually (@khiav223577)
9
+
10
+ ### [v1.1.0](https://github.com/khiav223577/adaptive_alias/compare/v1.0.0...v1.1.0) 2022/09/27
11
+ - [#22](https://github.com/khiav223577/adaptive_alias/pull/22) [Fix] Creation via autosave(belongs_to) association (@khiav223577)
12
+
13
+ ### [v1.0.0](https://github.com/khiav223577/adaptive_alias/compare/v0.2.4...v1.0.0) 2022/09/22
14
+ - [#21](https://github.com/khiav223577/adaptive_alias/pull/21) [Fix] Model with ignored_columns or calling find_by directly on model class with aliased column argument will fail (@khiav223577)
15
+ - [#20](https://github.com/khiav223577/adaptive_alias/pull/20) [Fix] Problems with STI classes and models that uses same table name (@khiav223577)
16
+ - [#19](https://github.com/khiav223577/adaptive_alias/pull/19) [Fix] Rescue the error when doing direct access to target table's field (@khiav223577)
17
+
18
+ ### [v0.2.4](https://github.com/khiav223577/adaptive_alias/compare/v0.2.3...v0.2.4) 2022/08/18
19
+ - [#18](https://github.com/khiav223577/adaptive_alias/pull/18) [Fix] Get model from a relation with join will not generate right query (after migration) (@khiav223577)
20
+
21
+ ### [v0.2.3](https://github.com/khiav223577/adaptive_alias/compare/v0.2.2...v0.2.3) 2022/08/17
22
+ - [#17](https://github.com/khiav223577/adaptive_alias/pull/17) [Feature] Support joins (@khiav223577)
23
+ - [#16](https://github.com/khiav223577/adaptive_alias/pull/16) [Enhance] No need to clone node (@khiav223577)
24
+ - [#15](https://github.com/khiav223577/adaptive_alias/pull/15) [Test] Add test cases to test calling pluck on same model (@khiav223577)
25
+
26
+ ### [v0.2.2](https://github.com/khiav223577/adaptive_alias/compare/v0.2.1...v0.2.2) 2022/08/11
27
+ - [#14](https://github.com/khiav223577/adaptive_alias/pull/14) [Fix] Fail to use backward-patch when target column has already been migrated (@khiav223577)
28
+
29
+ ### [v0.2.1](https://github.com/khiav223577/adaptive_alias/compare/v0.2.0...v0.2.1) 2022/08/11
30
+ - [#13](https://github.com/khiav223577/adaptive_alias/pull/13) [Fix] Nested module include is not supported until ruby 3.0 (@khiav223577)
31
+ - [#12](https://github.com/khiav223577/adaptive_alias/pull/12) [Test] Add test cases to test column_names (@khiav223577)
32
+
33
+ ### [v0.2.0](https://github.com/khiav223577/adaptive_alias/compare/v0.1.0...v0.2.0) 2022/08/05
34
+ - [#11](https://github.com/khiav223577/adaptive_alias/pull/11) [Feature] Support polymorphic (@khiav223577)
35
+ - [#10](https://github.com/khiav223577/adaptive_alias/pull/10) [Enhance] Prevent adding methods directly in class / module (@khiav223577)
36
+ - [#9](https://github.com/khiav223577/adaptive_alias/pull/9) [Enhance] Prevent changing original order of where conditions (@khiav223577)
37
+ - [#8](https://github.com/khiav223577/adaptive_alias/pull/8) [Test] Make sure we are reset to use original patch when some test cases fail (@khiav223577)
38
+ - [#7](https://github.com/khiav223577/adaptive_alias/pull/7) [Test] Add test cases to test destroy (@khiav223577)
39
+
40
+ ### [v0.1.0](https://github.com/khiav223577/adaptive_alias/compare/v0.0.3...v0.1.0) 2022/08/01
41
+ - [#6](https://github.com/khiav223577/adaptive_alias/pull/6) [Feature] Deal with creating records (@khiav223577)
42
+ - [#5](https://github.com/khiav223577/adaptive_alias/pull/5) [Enhance] Prevent infinite loop if something went wrong (@khiav223577)
43
+ - [#4](https://github.com/khiav223577/adaptive_alias/pull/4) [Fix] Attributes writer method should be defined after schema changes (@khiav223577)
44
+
45
+ ### [v0.0.3](https://github.com/khiav223577/adaptive_alias/compare/v0.0.2...v0.0.3) 2022/07/27
46
+ - [#3](https://github.com/khiav223577/adaptive_alias/pull/3) [Fix] Prevent calling custom column names from raising missing attributes (@khiav223577)
47
+
48
+ ### [v0.0.2](https://github.com/khiav223577/adaptive_alias/compare/v0.0.1...v0.0.2) 2022/07/26
49
+ - [#2](https://github.com/khiav223577/adaptive_alias/pull/2) [Enhance] Doesn't need rails_compatibility in runtime (@khiav223577)
50
+
51
+ ### v0.0.1 2022/07/22
52
+ - [#1](https://github.com/khiav223577/adaptive_alias/pull/1) [Feature] Implement adaptive_alias features (@khiav223577)
data/README.md CHANGED
@@ -25,10 +25,12 @@ We need a way to automatically adjust the patch to adapt current schema.
25
25
 
26
26
  ```
27
27
 
28
- This is what this gem wants to achieve. We don't want to do complex migrations, take care of backward-compatibiliy, and have any downtime.
28
+ This is what this gem wants to achieve. We don't want to do complex migrations, take care of backward-compatibility, and have any downtime.
29
29
  Just rely on this gem.
30
30
 
31
31
 
32
+ Note that it is not thread-safe when swapping patches, please make sure there is no multi-thread during migration.
33
+
32
34
  ## Supports
33
35
  - Ruby 2.6 ~ 2.7, 3.0 ~ 3.1
34
36
  - Rails 6.0, 6.1, 7.0
data/gemfiles/6.0.gemfile CHANGED
@@ -6,6 +6,7 @@ group :test do
6
6
  gem 'simplecov', '< 0.18'
7
7
  gem 'mysql2', '0.5.3'
8
8
  gem 'acts-as-taggable-on', '~> 7.0.0'
9
+ gem 'identity_cache', '~> 1.2.0'
9
10
  end
10
11
 
11
12
  gemspec path: '../'
data/gemfiles/6.1.gemfile CHANGED
@@ -6,6 +6,7 @@ group :test do
6
6
  gem 'simplecov', '< 0.18'
7
7
  gem 'mysql2', '0.5.3'
8
8
  gem 'acts-as-taggable-on', '~> 7.0.0'
9
+ gem 'identity_cache', '~> 1.2.0'
9
10
  end
10
11
 
11
12
  gemspec path: '../'
data/gemfiles/7.0.gemfile CHANGED
@@ -7,6 +7,7 @@ group :test do
7
7
  gem 'simplecov', '< 0.18'
8
8
  gem 'mysql2', '0.5.3'
9
9
  gem 'acts-as-taggable-on', '~> 9.0.0'
10
+ gem 'identity_cache', '~> 1.2.0'
10
11
  end
11
12
 
12
13
  gemspec path: '../'
@@ -18,6 +18,7 @@ module AdaptiveAlias
18
18
  name = self.class.attribute_aliases[name] || name
19
19
 
20
20
  sync_with_transaction_state if @transaction_state&.finalized?
21
+ attribute_set_fix!
21
22
  return @attributes.fetch_value(name, &block)
22
23
  end
23
24
  end
@@ -0,0 +1,16 @@
1
+ require 'active_record'
2
+
3
+ module AdaptiveAlias
4
+ module Hooks
5
+ module Calculations
6
+ def perform_calculation(*)
7
+ AdaptiveAlias.rescue_statement_invalid(relation: self){ super }
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ # Nested module include is not supported until ruby 3.0
14
+ class ActiveRecord::Relation
15
+ prepend AdaptiveAlias::Hooks::Calculations
16
+ end
@@ -11,7 +11,7 @@ module AdaptiveAlias
11
11
  add_hooks!(current_column: @new_column, alias_column: @old_column, log_warning: true)
12
12
  end
13
13
 
14
- def remove!
14
+ def do_remove!
15
15
  super
16
16
  @klass.remove_alias_attribute(@old_column)
17
17
  @klass.define_attribute_method(@old_column)
@@ -3,8 +3,8 @@
3
3
  module AdaptiveAlias
4
4
  module Patches
5
5
  class Base
6
- attr_reader :fix_association
7
- attr_reader :fix_missing_attribute
6
+ attr_reader :check_matched
7
+ attr_reader :remove_and_fix_association
8
8
  attr_reader :removed
9
9
  attr_reader :removable
10
10
 
@@ -23,24 +23,24 @@ module AdaptiveAlias
23
23
  AdaptiveAlias.get_or_create_model_module(klass).instance_exec do
24
24
  remove_method(new_column) if method_defined?(new_column)
25
25
  define_method(new_column) do
26
- AdaptiveAlias.rescue_missing_attribute(klass){ self[new_column] }
26
+ self[new_column]
27
27
  end
28
28
 
29
29
  remove_method("#{new_column}=") if method_defined?("#{new_column}=")
30
30
  define_method("#{new_column}=") do |*args|
31
- AdaptiveAlias.rescue_missing_attribute(klass){ super(*args) }
31
+ super(*args)
32
32
  end
33
33
 
34
34
  remove_method(old_column) if method_defined?(old_column)
35
35
  define_method(old_column) do
36
36
  patch.log_warning if log_warning
37
- AdaptiveAlias.rescue_missing_attribute(klass){ self[old_column] }
37
+ self[old_column]
38
38
  end
39
39
 
40
40
  remove_method("#{old_column}=") if method_defined?("#{old_column}=")
41
41
  define_method("#{old_column}=") do |*args|
42
42
  patch.log_warning if log_warning
43
- AdaptiveAlias.rescue_missing_attribute(klass){ super(*args) }
43
+ super(*args)
44
44
  end
45
45
  end
46
46
 
@@ -54,24 +54,6 @@ module AdaptiveAlias
54
54
  "Mysql2::Error: Unknown column '#{current_column}' in 'field list'".freeze,
55
55
  ].freeze
56
56
 
57
- expected_attribute_err_msgs = [
58
- "can't write unknown attribute `#{current_column}`".freeze,
59
- "missing attribute: #{current_column}".freeze,
60
- ].freeze
61
-
62
- @fix_missing_attribute = proc do |error_klass, error|
63
- next false if not patch.removable
64
- next false if patch.removed
65
- next false if klass.table_name != error_klass.table_name
66
-
67
- # Error highlight behavior in Ruby 3.1 pollutes the error message
68
- error_msg = error.respond_to?(:original_message) ? error.original_message : error.message
69
- next false if not expected_attribute_err_msgs.include?(error_msg)
70
-
71
- patch.remove!
72
- next true
73
- end
74
-
75
57
  fix_arel_attributes = proc do |attr|
76
58
  next if not attr.is_a?(Arel::Attributes::Attribute)
77
59
  next if attr.name != current_column.to_s
@@ -87,9 +69,8 @@ module AdaptiveAlias
87
69
  end
88
70
  end
89
71
 
90
- @fix_association = proc do |relation, reflection, model, error|
72
+ @check_matched = proc do |relation, reflection, model, error|
91
73
  next false if not patch.removable
92
- next false if patch.removed
93
74
 
94
75
  # Error highlight behavior in Ruby 3.1 pollutes the error message
95
76
  error_msg = error.respond_to?(:original_message) ? error.original_message : error.message
@@ -103,25 +84,28 @@ module AdaptiveAlias
103
84
  end
104
85
 
105
86
  next false if not expected_association_err_msgs.include?(error_msg) and not ambiguous
87
+ next true
88
+ end
106
89
 
107
- patch.remove!
90
+ @remove_and_fix_association = proc do |relation, reflection, &block|
91
+ patch.remove! do
92
+ if relation
93
+ relation.reset # reset @arel
108
94
 
109
- if relation
110
- relation.reset # reset @arel
95
+ joins = relation.arel.source.right # @ctx.source.right << create_join(relation, nil, klass)
111
96
 
112
- joins = relation.arel.source.right # @ctx.source.right << create_join(relation, nil, klass)
97
+ # adjust select fields
98
+ index = relation.select_values.index(current_column)
99
+ relation.select_values[index] = alias_column if index
113
100
 
114
- # adjust select fields
115
- index = relation.select_values.index(current_column)
116
- relation.select_values[index] = alias_column if index
101
+ fix_arel_nodes.call(joins.map{|s| s.right.expr })
102
+ fix_arel_nodes.call(relation.where_clause.send(:predicates))
103
+ end
117
104
 
118
- fix_arel_nodes.call(joins.map{|s| s.right.expr })
119
- fix_arel_nodes.call(relation.where_clause.send(:predicates))
120
- end
105
+ reflection.clear_association_scope_cache if reflection
121
106
 
122
- reflection.clear_association_scope_cache if reflection
123
-
124
- next true
107
+ block.call
108
+ end
125
109
  end
126
110
  end
127
111
 
@@ -133,15 +117,24 @@ module AdaptiveAlias
133
117
  end
134
118
 
135
119
  def remove!
136
- @removed = true
120
+ if not @removed
121
+ @removed = true
122
+ new_patch = do_remove!
123
+ end
124
+
125
+ yield if block_given?
126
+ ensure
127
+ new_patch.mark_removable if new_patch
128
+ end
137
129
 
130
+ def do_remove!
138
131
  reset_caches(@klass)
139
132
  ActiveRecord::Base.descendants.each do |model_klass|
140
133
  reset_caches(model_klass) if model_klass.table_name == @klass.table_name
141
134
  end
142
135
 
143
- @fix_association = nil
144
- @fix_missing_attribute = nil
136
+ @check_matched = nil
137
+ @remove_and_fix_association = nil
145
138
  end
146
139
 
147
140
  def mark_removable
@@ -162,10 +155,14 @@ module AdaptiveAlias
162
155
  def each_nodes(nodes, &block)
163
156
  nodes.each do |node|
164
157
  case node
158
+ when Arel::Nodes::Grouping
159
+ each_nodes([node.expr], &block)
165
160
  when Arel::Nodes::Equality
166
161
  yield(node)
167
162
  when Arel::Nodes::And
168
163
  each_nodes(node.children, &block)
164
+ when Arel::Nodes::Or
165
+ each_nodes([node.left, node.right], &block)
169
166
  end
170
167
  end
171
168
  end
@@ -11,7 +11,7 @@ module AdaptiveAlias
11
11
  add_hooks!(current_column: @old_column, alias_column: @new_column)
12
12
  end
13
13
 
14
- def remove!
14
+ def do_remove!
15
15
  super
16
16
  @klass.remove_alias_attribute(@new_column)
17
17
  @klass.define_attribute_method(@new_column)
@@ -1,3 +1,3 @@
1
1
  module AdaptiveAlias
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -10,11 +10,10 @@ require 'adaptive_alias/patches/backward_patch'
10
10
  require 'adaptive_alias/patches/forward_patch'
11
11
 
12
12
  require 'adaptive_alias/hooks/association'
13
- require 'adaptive_alias/hooks/association_scope'
14
- require 'adaptive_alias/hooks/singular_association'
15
13
  require 'adaptive_alias/hooks/relation'
16
14
  require 'adaptive_alias/hooks/active_record_core'
17
15
  require 'adaptive_alias/hooks/active_record_persistence'
16
+ require 'adaptive_alias/hooks/calculations'
18
17
 
19
18
  module AdaptiveAlias
20
19
  @log_interval = 10 * 60
@@ -46,21 +45,12 @@ module AdaptiveAlias
46
45
  def rescue_statement_invalid(relation: nil, reflection: nil, model: nil, &block)
47
46
  yield
48
47
  rescue ActiveRecord::StatementInvalid => error
49
- raise error if AdaptiveAlias.current_patches.all?{|_key, patch| !patch.fix_association.call(relation, reflection, model, error) }
48
+ _key, patch = AdaptiveAlias.current_patches.find{|_key, patch| patch.check_matched.call(relation, reflection, model, error) }
49
+ raise error if patch == nil
50
50
 
51
- result = rescue_statement_invalid(relation: relation, reflection: reflection, model: model, &block)
52
- AdaptiveAlias.current_patches.each_value(&:mark_removable)
53
- return result
54
- end
55
-
56
- def rescue_missing_attribute(klass, &block)
57
- yield
58
- rescue ActiveModel::MissingAttributeError => error
59
- raise error if AdaptiveAlias.current_patches.all?{|_key, patch| !patch.fix_missing_attribute.call(klass, error) }
60
-
61
- result = rescue_missing_attribute(klass, &block)
62
- AdaptiveAlias.current_patches.each_value(&:mark_removable)
63
- return result
51
+ patch.remove_and_fix_association.call(relation, reflection) do
52
+ return rescue_statement_invalid(relation: relation, reflection: reflection, model: model, &block)
53
+ end
64
54
  end
65
55
 
66
56
  def get_or_create_model_module(klass)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adaptive_alias
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - khiav reoy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,9 +131,8 @@ files:
131
131
  - lib/adaptive_alias/hooks/active_record_core.rb
132
132
  - lib/adaptive_alias/hooks/active_record_persistence.rb
133
133
  - lib/adaptive_alias/hooks/association.rb
134
- - lib/adaptive_alias/hooks/association_scope.rb
134
+ - lib/adaptive_alias/hooks/calculations.rb
135
135
  - lib/adaptive_alias/hooks/relation.rb
136
- - lib/adaptive_alias/hooks/singular_association.rb
137
136
  - lib/adaptive_alias/patches/backward_patch.rb
138
137
  - lib/adaptive_alias/patches/base.rb
139
138
  - lib/adaptive_alias/patches/forward_patch.rb
@@ -1,13 +0,0 @@
1
- module AdaptiveAlias
2
- module Hooks
3
- module AssociationScope
4
- def last_chain_scope(_scope, reflection, owner)
5
- AdaptiveAlias.rescue_missing_attribute(owner.class){ super }
6
- end
7
- end
8
- end
9
- end
10
-
11
- class ActiveRecord::Associations::AssociationScope
12
- prepend AdaptiveAlias::Hooks::AssociationScope
13
- end
@@ -1,13 +0,0 @@
1
- module AdaptiveAlias
2
- module Hooks
3
- module SingularAssociation
4
- def reader(*)
5
- AdaptiveAlias.rescue_missing_attribute(owner.class){ super }
6
- end
7
- end
8
- end
9
- end
10
-
11
- class ActiveRecord::Associations::SingularAssociation
12
- prepend AdaptiveAlias::Hooks::SingularAssociation
13
- end