query_helper 0.2.30 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03de8ed1f4ad37b3fd8eb07edfedd5829c06e3502e78450fcbea037841a55bd7
4
- data.tar.gz: 79598bdaca7ee9073f90858c906a5492c6eec8e4e6e514ddaa8397d0cf0afcc1
3
+ metadata.gz: b9626c22503b7f257a4276b969a498a017753e879e30b04b6643c618ae8f03d4
4
+ data.tar.gz: 825fdbf988d8a41abd89d250aa6d56f0add379fced68e630099ea688cde9b586
5
5
  SHA512:
6
- metadata.gz: 75cf73dd094f480095b4d0e2b8d9ae941d54a817e172dcbc3ddcc270f5c97e8c64e8303d5df8b3b0d876cb3ae5c230426920f329659892574db5889cb0ab1cd4
7
- data.tar.gz: 25e7609715272868b5f6baf61a229d704b21cbc97f6a71be5a28126f763f9472088bc396498d60208492a2b582ac17d1994bbd2e8293c685b423c199da864e31
6
+ metadata.gz: 1ce4589b5783e435ec47b22b2e04b094d8f5da5703b439510b7a9570d8dc0d87d505d2e2fca6125b1c180707bcae9001af9d3f40003c2747966f09a420978237
7
+ data.tar.gz: 9c8188da6470cd4469a4825e21725cbc1d19b5fcd1f246eb0d86d2dddd589ddcb7be30c8a500a3650b1a61fb2d2a622f6ff41388a8193bacda3544ca3974d81c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- query_helper (0.2.30)
4
+ query_helper (0.3.4)
5
5
  activerecord (> 5)
6
6
  activesupport (> 5)
7
7
  sqlite3
@@ -43,13 +43,13 @@ GEM
43
43
  i18n (>= 0.7)
44
44
  i18n (1.8.10)
45
45
  concurrent-ruby (~> 1.0)
46
- loofah (2.12.0)
46
+ loofah (2.18.0)
47
47
  crass (~> 1.0.2)
48
48
  nokogiri (>= 1.5.9)
49
49
  method_source (1.0.0)
50
50
  mini_portile2 (2.8.0)
51
51
  minitest (5.14.4)
52
- nokogiri (1.13.3)
52
+ nokogiri (1.13.8)
53
53
  mini_portile2 (~> 2.8.0)
54
54
  racc (~> 1.4)
55
55
  racc (1.6.0)
@@ -59,7 +59,7 @@ GEM
59
59
  rails-dom-testing (2.0.3)
60
60
  activesupport (>= 4.2.0)
61
61
  nokogiri (>= 1.6)
62
- rails-html-sanitizer (1.4.2)
62
+ rails-html-sanitizer (1.4.3)
63
63
  loofah (~> 2.3)
64
64
  railties (6.1.4.1)
65
65
  actionpack (= 6.1.4.1)
@@ -89,7 +89,8 @@ GEM
89
89
  rspec-mocks (~> 3.10)
90
90
  rspec-support (~> 3.10)
91
91
  rspec-support (3.10.2)
92
- sqlite3 (1.4.2)
92
+ sqlite3 (1.6.2)
93
+ mini_portile2 (~> 2.8.0)
93
94
  thor (1.1.0)
94
95
  tzinfo (2.0.4)
95
96
  concurrent-ruby (~> 1.0)
@@ -8,12 +8,24 @@ class QueryHelper
8
8
  def self.load_associations(payload:, associations: [], as_json_options: {})
9
9
  as_json_options ||= {}
10
10
  as_json_options[:include] = as_json_options[:include] || json_associations(associations)
11
- ActiveRecord::Associations::Preloader.new.preload(payload, associations)
11
+ begin
12
+ # Preloader have been changed in Rails 7, which is giving error on upgrade.
13
+ # This should be updated to latest API once all repos have been upgraded to Rails 7
14
+ ActiveRecord::Associations::Preloader.new.preload(payload, associations)
15
+ rescue
16
+ ActiveRecord::Associations::Preloader.new(records: payload, associations: associations).call
17
+ end
12
18
  payload.as_json(as_json_options)
13
19
  end
14
20
 
15
21
  def self.preload_associations(payload:, preload: [])
16
- ActiveRecord::Associations::Preloader.new.preload(payload, preload)
22
+ begin
23
+ # Preloader have been changed in Rails 7, which is giving error on upgrade.
24
+ # This should be updated to latest API once all repos have been upgraded to Rails 7
25
+ ActiveRecord::Associations::Preloader.new.preload(payload, preload)
26
+ rescue
27
+ ActiveRecord::Associations::Preloader.new(records: payload, associations: preload).call
28
+ end
17
29
  end
18
30
 
19
31
  def self.json_associations(associations)
@@ -26,8 +26,8 @@ class QueryHelper
26
26
  end
27
27
 
28
28
  def build
29
- insert_having_clauses()
30
29
  insert_qualify_clauses()
30
+ insert_having_clauses()
31
31
  insert_where_clauses()
32
32
  insert_select_clauses()
33
33
  insert_order_by_and_limit_clause()
@@ -49,7 +49,7 @@ class QueryHelper
49
49
 
50
50
  def qualify_clauses(index)
51
51
  if index == 0
52
- "qualified_results AS ( "
52
+ "WITH qualified_results AS ( "
53
53
  else
54
54
  ", qualified_results AS ( "
55
55
  end
@@ -114,7 +114,7 @@ class QueryHelper
114
114
  end
115
115
 
116
116
  def insert_where_index
117
- group_by_index() || order_by_index() || limit_index() || @sql.length
117
+ qualify_index() || group_by_index() || order_by_index() || limit_index() || @sql.length
118
118
  end
119
119
 
120
120
  def insert_qualify_index
@@ -1,3 +1,3 @@
1
1
  class QueryHelper
2
- VERSION = "0.2.30"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.30
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patterninc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-24 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler