active_record_extended 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_extended/query_methods/json.rb +2 -2
- data/lib/active_record_extended/query_methods/select.rb +2 -2
- data/lib/active_record_extended/query_methods/unionize.rb +1 -1
- data/lib/active_record_extended/utilities/order_by.rb +2 -2
- data/lib/active_record_extended/utilities/support.rb +1 -1
- data/lib/active_record_extended/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29516f7d7b4854e6a04653d6e146e5945efa9ade39ad99d171e17bd2f11e1fe3
|
4
|
+
data.tar.gz: f898fa543fe7d79f9fa98e015e86044cccf7ae4c940abe13c912fbb9d435a010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b10866d1c5e95ddb6e37df09085b1e86183bfa9b4b217b71f5f3ce8973926fc6f83591c352515098d5800276afaf1ff538ac50bea8cd5f355da7d67768570970
|
7
|
+
data.tar.gz: 654a00730852609edf1ef1e47893896647d06548bc563aa4546713b7398981fbe050d7951dee47eb2b97c673e370ff40b0949aa763c6665662deb3c08625bc53
|
@@ -51,7 +51,7 @@ module ActiveRecordExtended
|
|
51
51
|
private
|
52
52
|
|
53
53
|
def build_json_literal(arel_klass, values:, col_alias: DEFAULT_ALIAS)
|
54
|
-
json_values = flatten_to_sql(values.to_a
|
54
|
+
json_values = flatten_to_sql(values.to_a) { |value| literal_key(value) }
|
55
55
|
col_alias = double_quote(col_alias)
|
56
56
|
json_build_obj = arel_klass.new(json_values)
|
57
57
|
@scope.select(nested_alias_escape(json_build_obj, col_alias))
|
@@ -117,7 +117,7 @@ module ActiveRecordExtended
|
|
117
117
|
lean_opts.call(:value) { arg.delete(:value).presence }
|
118
118
|
lean_opts.call(:col_alias) { arg.delete(:as) }
|
119
119
|
lean_opts.call(:order_by) { order_by_expression(arg.delete(:order_by)) }
|
120
|
-
lean_opts.call(:from) { arg.delete(:from).tap
|
120
|
+
lean_opts.call(:from) { arg.delete(:from).tap { |from_clause| pipe_cte_with!(from_clause) } }
|
121
121
|
lean_opts.call(:cast_with) { casting_options(arg.delete(:cast_with) || arg.delete(:cast_as_array)) }
|
122
122
|
end
|
123
123
|
|
@@ -65,7 +65,7 @@ module ActiveRecordExtended
|
|
65
65
|
def hash_to_dot_notation(column)
|
66
66
|
case column
|
67
67
|
when Hash, Array
|
68
|
-
column.to_a.flat_map(
|
68
|
+
column.to_a.flat_map { |col| hash_to_dot_notation(col) }.join(".")
|
69
69
|
when String, Symbol
|
70
70
|
/^([[:alpha:]]+)$/.match?(column.to_s) ? double_quote(column) : column
|
71
71
|
else
|
@@ -92,7 +92,7 @@ module ActiveRecordExtended
|
|
92
92
|
when "array", "true"
|
93
93
|
wrap_with_array(query, alias_name)
|
94
94
|
when AGGREGATE_ONE_LINERS
|
95
|
-
expr = to_sql_array(query
|
95
|
+
expr = to_sql_array(query) { |value| group_when_needed(value) }
|
96
96
|
casted_query = ::Arel::Nodes::AggregateFunctionName.new(cast_with, expr, distinct).order_by(order_expr)
|
97
97
|
nested_alias_escape(casted_query, alias_name)
|
98
98
|
else
|
@@ -59,7 +59,7 @@ module ActiveRecordExtended
|
|
59
59
|
protected
|
60
60
|
|
61
61
|
def append_union_order!(union_type, args)
|
62
|
-
args.each
|
62
|
+
args.each { |arg| pipe_cte_with!(arg) }
|
63
63
|
flatten_scopes = flatten_to_sql(args)
|
64
64
|
@scope.union_values += flatten_scopes
|
65
65
|
calculate_union_operation!(union_type, flatten_scopes.size)
|
@@ -24,8 +24,8 @@ module ActiveRecordExtended
|
|
24
24
|
return false unless order_by && order_by.presence.present?
|
25
25
|
|
26
26
|
to_ordered_table_path(order_by)
|
27
|
-
.tap
|
28
|
-
.tap(
|
27
|
+
.tap { |order_args| process_ordering_arguments!(order_args) }
|
28
|
+
.tap { |order_args| scope_preprocess_order_args(order_args) }
|
29
29
|
end
|
30
30
|
|
31
31
|
#
|
@@ -172,7 +172,7 @@ module ActiveRecordExtended
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def generate_named_function(function_name, *args)
|
175
|
-
args.map!(
|
175
|
+
args.map! { |arg| to_arel_sql(arg) }
|
176
176
|
function_name = function_name.to_s.upcase
|
177
177
|
::Arel::Nodes::NamedFunction.new(to_arel_sql(function_name), args)
|
178
178
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_extended
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Protacio-Karaszi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-11-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|