active_record_extended 1.3.0 → 1.3.1

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: 69a8ed712b33088a8aa79eb2d89ba86f645882d085d3bb752fb997eb1888b6af
4
- data.tar.gz: a60306c9e2551606772007b683dee9477d7c87545569647c47a78e45a92b21bc
3
+ metadata.gz: 2c136dceff4eb13a4c368aef03c70ae74bf3c856d3dadaa38e468e3f3369455d
4
+ data.tar.gz: 1d7f194a4760a812e2a6aa22f20e1a62914e68d1fcb52cb223d724104597cc31
5
5
  SHA512:
6
- metadata.gz: 5530aaaf8f2f45aa1f7daaed6398eeac033cd50c3fb542a427dac4b9097c6ebffe08928f6d7a13bacdf9e04509f26f85ed607d4622e16423ced1308e079a2cf7
7
- data.tar.gz: 8ca7691c2c23da13e8f1a409eeb5528ed47f01736f4cabbefa06fe441f56cae24ff504b1a0b31996645ef6bba7e2c308e1a8ee6254ee795d3a5fdbd15b0de57b
6
+ metadata.gz: a0d6e454d6c2dc91d28472cc1911043bc62a94e554d85bc77b0cdbbdedcc4158f7f6f43164a7cd5b27d8609ececf4b532f9a4ebe26c725267c77de4b1c201d38
7
+ data.tar.gz: 28980520ea5779c79a9fd131157a5b2cdecba1d1fa8464dbba34ef299501094e97db64db303c5d0ad51cf3cb2a52b130562a71d64f866e67f6446ce79082de74
@@ -81,7 +81,7 @@ module ActiveRecordExtended
81
81
  else
82
82
  replicate_klass = from.respond_to?(:unscoped) ? from.unscoped : @scope.unscoped
83
83
  replicate_klass.from(from.dup, reference_key)
84
- end
84
+ end.unscope(:where)
85
85
  end
86
86
 
87
87
  # Will carry defined CTE tables from the nested sub-query and gradually pushes it up to the parents query stack
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordExtended
4
- VERSION = "1.3.0"
4
+ VERSION = "1.3.1"
5
5
  end
@@ -53,6 +53,13 @@ RSpec.describe "JSON Methods SQL Queries" do
53
53
  end
54
54
  end
55
55
  end
56
+
57
+ context "when the subquery is a STI record type" do
58
+ it "should not append sti 'type IN(..)' where clauses to the nested query" do
59
+ query = User.select_row_to_json(AdminSti.where(id: 10), cast_with: :array, key: :convert_this, as: :results).to_sql
60
+ expect(query).to match_regex(/SELECT \(ARRAY\(SELECT ROW_TO_JSON\("convert_this"\) FROM \(.*\) convert_this\)\) AS .+/)
61
+ end
62
+ end
56
63
  end
57
64
 
58
65
  describe ".json_build_object" do
@@ -20,6 +20,12 @@ class User < ApplicationRecord
20
20
  #
21
21
  end
22
22
 
23
+ class StiRecord < ApplicationRecord
24
+ # t.string "type"
25
+ end
26
+
27
+ class AdminSti < StiRecord; end
28
+
23
29
  module Namespaced
24
30
  def self.table_name_prefix
25
31
  "namespaced_"
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.3.0
4
+ version: 1.3.1
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-09-04 00:00:00.000000000 Z
13
+ date: 2019-10-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord