active_record-union_relation 0.3.0 → 0.3.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 +8 -1
- data/lib/active_record/union_relation/version.rb +1 -1
- data/lib/active_record/union_relation.rb +7 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a44a29b536f6a031c370506521ff22235e6d9428e014116ad12d0b77835da95c
|
4
|
+
data.tar.gz: c9d0b819415abda322cbe55a29fef365ad4c8ec2476d9d8b833daad1fd8d162c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60392196abdf6f3262b147823fbc426204ea6625add61191d43499dcb09b14bac7a03e44de3f72c433c0b493456050303e67aec6123cd86a41b66ed29f3e3012
|
7
|
+
data.tar.gz: c29e2b089330b86fba7c8f41531959b4a1ff2be2b2f56fa45e61ea8635ff8f4144c913eb80b20faceebee02f320279ea6b1eb0c62326b9eaf2f5f9c4f31c8740
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.3.1] - 2024-09-19
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- Fix up relations with a single source model.
|
14
|
+
|
9
15
|
## [0.3.0] - 2024-06-13
|
10
16
|
|
11
17
|
### Added
|
@@ -37,7 +43,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
37
43
|
|
38
44
|
- 🎉 Initial release. 🎉
|
39
45
|
|
40
|
-
[unreleased]: https://github.com/kddnewton/active_record-union_relation/compare/v0.3.
|
46
|
+
[unreleased]: https://github.com/kddnewton/active_record-union_relation/compare/v0.3.1...HEAD
|
47
|
+
[0.3.1]: https://github.com/kddnewton/active_record-union_relation/compare/v0.3.0...v0.3.1
|
41
48
|
[0.3.0]: https://github.com/kddnewton/active_record-union_relation/compare/v0.2.1...v0.3.0
|
42
49
|
[0.2.1]: https://github.com/kddnewton/active_record-union_relation/compare/v0.2.0...v0.2.1
|
43
50
|
[0.2.0]: https://github.com/kddnewton/active_record-union_relation/compare/v0.1.1...v0.2.0
|
@@ -197,9 +197,13 @@ module ActiveRecord
|
|
197
197
|
|
198
198
|
def union_for(model)
|
199
199
|
Arel::Nodes::As.new(
|
200
|
-
subqueries
|
201
|
-
.
|
202
|
-
|
200
|
+
if subqueries.one?
|
201
|
+
subqueries.first.to_arel(columns, discriminator)
|
202
|
+
else
|
203
|
+
subqueries
|
204
|
+
.map { |subquery| subquery.to_arel(columns, discriminator).ast }
|
205
|
+
.inject { |left, right| Arel::Nodes::Union.new(left, right) }
|
206
|
+
end,
|
203
207
|
Arel.sql(model.connection.quote_table_name("union"))
|
204
208
|
)
|
205
209
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record-union_relation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -99,7 +99,7 @@ licenses:
|
|
99
99
|
- MIT
|
100
100
|
metadata:
|
101
101
|
bug_tracker_uri: https://github.com/kddnewton/active_record-union_relation/issues
|
102
|
-
changelog_uri: https://github.com/kddnewton/active_record-union_relation/blob/v0.3.
|
102
|
+
changelog_uri: https://github.com/kddnewton/active_record-union_relation/blob/v0.3.1/CHANGELOG.md
|
103
103
|
source_code_uri: https://github.com/kddnewton/active_record-union_relation
|
104
104
|
rubygems_mfa_required: 'true'
|
105
105
|
post_install_message:
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.6.0.dev
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Create ActiveRecord relations from UNIONs
|