active_record_extended 3.3.0 → 3.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9536d7712c3ce9ae40dd62525b5799ff2848e5ba94092c3f6d3c995ffe5467c
|
4
|
+
data.tar.gz: deb23d8497e024312c99a0a24723b7ffba98dc60d9f7027863b3c2901ee0070e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff01f56a0b3fad3363809e3e89eac38642990beed9650c72573636581b1f7f8aed2ccefc5c4e74118be402fe180aaf2bdd8f12bd32d03a99fb172afe6aa8293d
|
7
|
+
data.tar.gz: f35c78ca01d1280638622f04aa1520999f3fb6f8d2ea1fc3949890b8949d5e644025fc5da97393e68e08dd4076589c9f6271374b06e84ed1bdac7af4a14dbf60
|
data/README.md
CHANGED
@@ -51,13 +51,13 @@ Active Record Extended is essentially providing users with the other half of Pos
|
|
51
51
|
|
52
52
|
## Compatibility
|
53
53
|
|
54
|
-
This package is designed align and work with any officially supported Ruby and Rails versions.
|
54
|
+
This package is designed to align and work with any officially supported Ruby and Rails versions.
|
55
55
|
- Minimum Ruby Version: 3.1.x **(EOL warning!)**
|
56
56
|
- Minimum Rails Version: 6.1.x **(EOL warning!)**
|
57
57
|
- Minimum Postgres Version: 12.x **(EOL warning!)**
|
58
|
-
- Latest Ruby supported: 3.
|
59
|
-
- Latest Rails supported:
|
60
|
-
- Postgres: 11-current(
|
58
|
+
- Latest Ruby supported: 3.4.x
|
59
|
+
- Latest Rails supported: 8.0.x
|
60
|
+
- Postgres: 11-current(18) (probably works with most older versions to a certain point)
|
61
61
|
|
62
62
|
## Installation
|
63
63
|
|
@@ -560,7 +560,7 @@ As a means for taking complex query logic and transform them into a single or m
|
|
560
560
|
|
561
561
|
**Options:**
|
562
562
|
- `as`: [Symbol or String] (defaults to `"results"`): What the column will be aliased to
|
563
|
-
- `value`: [Symbol or String] (defaults to `key` argument): How the response should
|
563
|
+
- `value`: [Symbol or String] (defaults to `key` argument): How the response should handle the json value return
|
564
564
|
|
565
565
|
See the included example on [Row To JSON](#row-to-json) to see it in action.
|
566
566
|
|
@@ -606,7 +606,7 @@ There's an issue with providing a single union clause and chaining it with a dif
|
|
606
606
|
This is due to requirements of grouping SQL statements. The issue is being working on, but with no ETA.
|
607
607
|
|
608
608
|
This issue only applies to the first initial set of unions and is recommended that you union two relations right off the bat.
|
609
|
-
|
609
|
+
Afterwards you can union/chain single relations.
|
610
610
|
|
611
611
|
Example
|
612
612
|
|
@@ -263,7 +263,7 @@ module ActiveRecordExtended
|
|
263
263
|
# - as: [Symbol or String] (default="results"): What the column will be aliased to
|
264
264
|
#
|
265
265
|
#
|
266
|
-
# - value: [Symbol or String] (defaults=[key]): How the response should
|
266
|
+
# - value: [Symbol or String] (defaults=[key]): How the response should handle the json value return
|
267
267
|
#
|
268
268
|
# Example:
|
269
269
|
#
|
@@ -3,8 +3,9 @@
|
|
3
3
|
module ActiveRecordExtended
|
4
4
|
module QueryMethods
|
5
5
|
module Unionize
|
6
|
-
UNION_RELATION_METHODS
|
7
|
-
UNIONIZE_METHODS
|
6
|
+
UNION_RELATION_METHODS = [:order_union, :reorder_union, :union_as].freeze
|
7
|
+
UNIONIZE_METHODS = [:union, :union_all, :union_except, :union_intersect].freeze
|
8
|
+
DEFAULT_STORAGE_VALUE = proc { [] }
|
8
9
|
|
9
10
|
class UnionChain
|
10
11
|
include ActiveRecordExtended::Utilities::Support
|
@@ -86,15 +87,17 @@ module ActiveRecordExtended
|
|
86
87
|
end
|
87
88
|
|
88
89
|
{
|
89
|
-
union_values:
|
90
|
-
union_operations:
|
91
|
-
union_ordering_values:
|
92
|
-
unionized_name:
|
90
|
+
union_values: DEFAULT_STORAGE_VALUE,
|
91
|
+
union_operations: DEFAULT_STORAGE_VALUE,
|
92
|
+
union_ordering_values: DEFAULT_STORAGE_VALUE,
|
93
|
+
unionized_name: proc { arel_table.name }
|
93
94
|
}.each_pair do |method_name, default|
|
94
95
|
define_method(method_name) do
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
if send(:"#{method_name}?")
|
97
|
+
unionize_storage[method_name]
|
98
|
+
else
|
99
|
+
instance_eval(&default)
|
100
|
+
end
|
98
101
|
end
|
99
102
|
|
100
103
|
define_method(:"#{method_name}?") do
|
@@ -141,7 +144,7 @@ module ActiveRecordExtended
|
|
141
144
|
|
142
145
|
protected
|
143
146
|
|
144
|
-
def build_unions(arel
|
147
|
+
def build_unions(arel)
|
145
148
|
return unless union_values?
|
146
149
|
|
147
150
|
union_nodes = apply_union_ordering(build_union_nodes!)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "active_record_extended/version"
|
4
4
|
|
5
|
+
require "logger"
|
5
6
|
require "active_record"
|
6
7
|
require "active_record/relation"
|
7
8
|
require "active_record/relation/merger"
|
@@ -10,7 +11,7 @@ require "active_record/relation/query_methods"
|
|
10
11
|
module ActiveRecordExtended
|
11
12
|
extend ActiveSupport::Autoload
|
12
13
|
|
13
|
-
|
14
|
+
AR_VERSION_GTE_8_0 = Gem::Requirement.new(">= 8.0").satisfied_by?(ActiveRecord.gem_version)
|
14
15
|
|
15
16
|
module Utilities
|
16
17
|
extend ActiveSupport::Autoload
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_extended
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Protacio-Karaszi
|
8
8
|
- Dan McClain
|
9
9
|
- Olivier El Mekki
|
10
|
-
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: activerecord
|
@@ -21,7 +20,7 @@ dependencies:
|
|
21
20
|
version: '5.2'
|
22
21
|
- - "<"
|
23
22
|
- !ruby/object:Gem::Version
|
24
|
-
version: 8.
|
23
|
+
version: '8.1'
|
25
24
|
type: :runtime
|
26
25
|
prerelease: false
|
27
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +30,7 @@ dependencies:
|
|
31
30
|
version: '5.2'
|
32
31
|
- - "<"
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: 8.
|
33
|
+
version: '8.1'
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
35
|
name: pg
|
37
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,7 +82,6 @@ licenses:
|
|
83
82
|
- MIT
|
84
83
|
metadata:
|
85
84
|
rubygems_mfa_required: 'true'
|
86
|
-
post_install_message:
|
87
85
|
rdoc_options: []
|
88
86
|
require_paths:
|
89
87
|
- lib
|
@@ -98,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
96
|
- !ruby/object:Gem::Version
|
99
97
|
version: '0'
|
100
98
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
99
|
+
rubygems_version: 3.7.2
|
103
100
|
specification_version: 4
|
104
101
|
summary: Adds extended functionality to Activerecord Postgres implementation
|
105
102
|
test_files: []
|