pg_serializable 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pg_serializable/version.rb +1 -1
- data/lib/pg_serializable/visitors/json.rb +10 -3
- 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: 648a712ad1604caafa1ce54620bde306d99f38fba5b3897b707bce2302ac15de
|
4
|
+
data.tar.gz: 00e8956c9bc8c41bb967e3340cf6a51b642a06061dd9d736e586696c7662a438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd39bd3c82b9732015cad9776b36c45e828fb890e2104c739ad250ee9ecf7aa913d6b328c358286f3f99e315d2b3bb8d63284ff3b679dfe0d0b89e079eaed019
|
7
|
+
data.tar.gz: fa604b60406ff47e4b1b7795f85481c1c10626ca9de59b221e94ba2bd20e70a9e75566ea464e184afbd03557ac916f240f84374326269f4b7de84926cd4a49b2
|
@@ -91,12 +91,19 @@ module PgSerializable
|
|
91
91
|
association = subject.association
|
92
92
|
through = association.through_reflection
|
93
93
|
source = association.source_reflection
|
94
|
+
join_name = source.collection? ? through.plural_name.to_sym : through.name
|
95
|
+
where_clause = begin
|
96
|
+
if through.belongs_to?
|
97
|
+
"#{table_alias}.#{through.join_foreign_key}=#{through.table_name}.#{subject.foreign_key}"
|
98
|
+
else
|
99
|
+
"#{through.table_name}.#{through.join_foreign_key}=#{table_alias}.#{subject.foreign_key}"
|
100
|
+
end
|
101
|
+
end
|
94
102
|
|
95
103
|
query = visit(association
|
96
104
|
.klass
|
97
|
-
.
|
98
|
-
.
|
99
|
-
.where("#{current_alias}.#{through.join_primary_key}=#{table_alias}.#{subject.foreign_key}")
|
105
|
+
.joins(join_name)
|
106
|
+
.where(where_clause), table_alias: current_alias)
|
100
107
|
.to_sql
|
101
108
|
|
102
109
|
"\'#{subject.label}\', (#{query})"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_serializable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- matthewjf
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|