activerecord-virtual_attributes 7.1.0 → 7.1.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/CHANGELOG.md +6 -1
- data/activerecord-virtual_attributes.gemspec +3 -4
- data/lib/active_record/virtual_attributes/version.rb +1 -1
- data/lib/active_record/virtual_attributes/virtual_arel.rb +0 -42
- data/lib/active_record/virtual_attributes/virtual_delegates.rb +5 -2
- data/lib/active_record/virtual_attributes/virtual_fields.rb +3 -0
- data/lib/active_record/virtual_attributes.rb +6 -2
- metadata +8 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26048751ad2fe218660a4b62fa6c89d6467e7d33404c463154a041cf638ff43c
|
4
|
+
data.tar.gz: 8c2302076104393e4e4eac994e854a951ee6c0588b3fbfefc6c95f3d8d905861
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34b460bb1293c44743f26c0b91d62d857f53158022f2777ffb29f97a2279b6a9bbd3d19e4cd83dafaee035061093da669da4ac2bb749f1524258ae5db8d5577c
|
7
|
+
data.tar.gz: 2b7876b8d6f5c0eeafaf2f2f7740943ead1cc25b0c211ee84e44365609d86c659c328103c432d0c01184d1c09f13f2af5226c9d05614ac7c875392e503ae981a
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ The versioning of this gem follows ActiveRecord versioning, and does not follow
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [7.1.1] - 2025-06-18
|
8
|
+
|
9
|
+
* Deprecate virtual_delegate without a type [#188](https://github.com/ManageIQ/activerecord-virtual_attributes/pull/188)
|
10
|
+
|
7
11
|
## [7.1.0] - 2025-02-19
|
8
12
|
|
9
13
|
* Use TableAlias for table aliasing [#168](https://github.com/ManageIQ/activerecord-virtual_attributes/pull/168)
|
@@ -111,7 +115,8 @@ The versioning of this gem follows ActiveRecord versioning, and does not follow
|
|
111
115
|
* Initial Release
|
112
116
|
* Extracted from ManageIQ/manageiq
|
113
117
|
|
114
|
-
[Unreleased]: https://github.com/ManageIQ/activerecord-virtual_attributes/compare/v7.1.
|
118
|
+
[Unreleased]: https://github.com/ManageIQ/activerecord-virtual_attributes/compare/v7.1.1...HEAD
|
119
|
+
[7.1.1]: https://github.com/ManageIQ/activerecord-virtual_attributes/compare/v7.1.0...v7.1.1
|
115
120
|
[7.1.0]: https://github.com/ManageIQ/activerecord-virtual_attributes/compare/v7.0.0...v7.1.0
|
116
121
|
[7.0.0]: https://github.com/ManageIQ/activerecord-virtual_attributes/compare/v6.1.2...v7.0.0
|
117
122
|
[6.1.2]: https://github.com/ManageIQ/activerecord-virtual_attributes/compare/v6.1.1...v6.1.2
|
@@ -28,14 +28,13 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.
|
32
|
-
# plan to ship a new 7.0 to fix it. See https://github.com/rails/rails/pull/54264
|
33
|
-
spec.add_runtime_dependency "activerecord", "~> 7.0", ">=7.0.8.7"
|
31
|
+
spec.add_runtime_dependency "activerecord", "~> 7.1", ">=7.1.5.1"
|
34
32
|
|
35
33
|
spec.add_development_dependency "byebug"
|
36
34
|
spec.add_development_dependency "database_cleaner-active_record", "~> 2.1"
|
37
35
|
spec.add_development_dependency "db-query-matchers"
|
38
|
-
spec.add_development_dependency "manageiq-style", ">= 1.5.
|
36
|
+
spec.add_development_dependency "manageiq-style", ">= 1.5.4"
|
37
|
+
|
39
38
|
spec.add_development_dependency "mysql2"
|
40
39
|
spec.add_development_dependency "pg"
|
41
40
|
spec.add_development_dependency "rake", "~> 13.0"
|
@@ -118,45 +118,3 @@ module ActiveRecord
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
# fixed in https://github.com/rails/rails/pull/45642
|
122
|
-
if ActiveRecord.version < Gem::Version.new(7.1)
|
123
|
-
module Arel # :nodoc: all
|
124
|
-
# rubocop:disable Naming/MethodName
|
125
|
-
# rubocop:disable Naming/MethodParameterName
|
126
|
-
# rubocop:disable Style/ConditionalAssignment
|
127
|
-
module Visitors
|
128
|
-
# rails 6.1...
|
129
|
-
class ToSql
|
130
|
-
private
|
131
|
-
|
132
|
-
def visit_Arel_Nodes_HomogeneousIn(o, collector)
|
133
|
-
collector.preparable = false
|
134
|
-
|
135
|
-
# change:
|
136
|
-
# See https://github.com/rails/rails/pull/45642
|
137
|
-
visit(o.left, collector)
|
138
|
-
# /change
|
139
|
-
|
140
|
-
if o.type == :in
|
141
|
-
collector << " IN ("
|
142
|
-
else
|
143
|
-
collector << " NOT IN ("
|
144
|
-
end
|
145
|
-
|
146
|
-
values = o.casted_values
|
147
|
-
|
148
|
-
if values.empty?
|
149
|
-
collector << @connection.quote(nil)
|
150
|
-
else
|
151
|
-
collector.add_binds(values, o.proc_for_binds, &bind_block)
|
152
|
-
end
|
153
|
-
|
154
|
-
collector << ")"
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
# rubocop:enable Naming/MethodName
|
159
|
-
# rubocop:enable Naming/MethodParameterName
|
160
|
-
# rubocop:enable Style/ConditionalAssignment
|
161
|
-
end
|
162
|
-
end
|
@@ -10,8 +10,7 @@ module ActiveRecord
|
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
class_attribute :virtual_delegates_to_define, :instance_accessor => false
|
14
|
-
self.virtual_delegates_to_define = {}
|
13
|
+
class_attribute :virtual_delegates_to_define, :instance_accessor => false, :default => {}
|
15
14
|
end
|
16
15
|
|
17
16
|
module ClassMethods
|
@@ -25,6 +24,10 @@ module ActiveRecord
|
|
25
24
|
raise ArgumentError, 'Delegation needs an association. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, to: :greeter).'
|
26
25
|
end
|
27
26
|
|
27
|
+
unless options[:type]
|
28
|
+
ActiveRecord::VirtualAttributes.deprecator.warn("Calling virtual_delegate without :type is now deprecated", caller)
|
29
|
+
end
|
30
|
+
|
28
31
|
to = to.to_s
|
29
32
|
if to.include?(".") && methods.size > 1
|
30
33
|
raise ArgumentError, 'Delegation only supports specifying a method name when defining a single virtual method'
|
@@ -170,6 +170,8 @@ module ActiveRecord
|
|
170
170
|
class Branch
|
171
171
|
prepend(Module.new {
|
172
172
|
# from branched.rb 7.0
|
173
|
+
# not going to modify rails code for rubocops
|
174
|
+
# rubocop:disable Lint/AmbiguousOperatorPrecedence
|
173
175
|
def grouped_records
|
174
176
|
h = {}
|
175
177
|
polymorphic_parent = !root? && parent.polymorphic?
|
@@ -184,6 +186,7 @@ module ActiveRecord
|
|
184
186
|
end
|
185
187
|
h
|
186
188
|
end
|
189
|
+
# rubocop:enable Lint/AmbiguousOperatorPrecedence
|
187
190
|
|
188
191
|
# branched.rb 7.0
|
189
192
|
def preloaders_for_reflection(reflection, reflection_records)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "active_support/concern"
|
2
2
|
require "active_record"
|
3
3
|
|
4
|
+
require "active_record/virtual_attributes/version"
|
4
5
|
require "active_record/virtual_attributes/virtual_includes"
|
5
6
|
require "active_record/virtual_attributes/virtual_arel"
|
6
7
|
require "active_record/virtual_attributes/virtual_delegates"
|
@@ -37,9 +38,12 @@ module ActiveRecord
|
|
37
38
|
ActiveRecord::Type.register(:string_set, Type::StringSet)
|
38
39
|
ActiveRecord::Type.register(:symbol, Type::Symbol)
|
39
40
|
|
41
|
+
def self.deprecator
|
42
|
+
@deprecator ||= ActiveSupport::Deprecation.new(ActiveRecord::VirtualAttributes::VERSION, "virtual_attributes")
|
43
|
+
end
|
44
|
+
|
40
45
|
included do
|
41
|
-
class_attribute :virtual_attributes_to_define, :instance_accessor => false
|
42
|
-
self.virtual_attributes_to_define = {}
|
46
|
+
class_attribute :virtual_attributes_to_define, :instance_accessor => false, :default => {}
|
43
47
|
end
|
44
48
|
|
45
49
|
module ClassMethods
|
metadata
CHANGED
@@ -1,49 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-virtual_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keenan Brock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: concurrent-ruby
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "<"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.3.5
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "<"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.3.5
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: activerecord
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7.
|
19
|
+
version: '7.1'
|
34
20
|
- - ">="
|
35
21
|
- !ruby/object:Gem::Version
|
36
|
-
version: 7.
|
22
|
+
version: 7.1.5.1
|
37
23
|
type: :runtime
|
38
24
|
prerelease: false
|
39
25
|
version_requirements: !ruby/object:Gem::Requirement
|
40
26
|
requirements:
|
41
27
|
- - "~>"
|
42
28
|
- !ruby/object:Gem::Version
|
43
|
-
version: '7.
|
29
|
+
version: '7.1'
|
44
30
|
- - ">="
|
45
31
|
- !ruby/object:Gem::Version
|
46
|
-
version: 7.
|
32
|
+
version: 7.1.5.1
|
47
33
|
- !ruby/object:Gem::Dependency
|
48
34
|
name: byebug
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +78,14 @@ dependencies:
|
|
92
78
|
requirements:
|
93
79
|
- - ">="
|
94
80
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.5.
|
81
|
+
version: 1.5.4
|
96
82
|
type: :development
|
97
83
|
prerelease: false
|
98
84
|
version_requirements: !ruby/object:Gem::Requirement
|
99
85
|
requirements:
|
100
86
|
- - ">="
|
101
87
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.5.
|
88
|
+
version: 1.5.4
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
90
|
name: mysql2
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|