optic-rails 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 +4 -4
- data/lib/optic/rails.rb +6 -2
- data/lib/optic/rails/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: 9c86b9eac93434bd8297c433d5f10c4c1827e4905cf4c7d6e62fe5f4c3ee6fec
|
4
|
+
data.tar.gz: 2c15c7a1cb011386bc64f632af5b49b571289773195f44dedc3fced6d78ea65c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c35b4031d5c8c6ca5aa4e1e10d7955c5db635d29208bcfe7e69042cd3586bb9e65b2382935525c209ee9262dce93538d71ebcd31dc98ac1ab3a0805f6b06f34
|
7
|
+
data.tar.gz: 01432f5d8f521e78d12c60e2e4e686cbf95b6c4995f1fb5366d9293236527affbd6c117020dda37df3c806e977a49106c9bf6973b1acfeb0dfc4c7ab34ef8ebd
|
data/lib/optic/rails.rb
CHANGED
@@ -33,7 +33,7 @@ module Optic
|
|
33
33
|
with_connection do |connection|
|
34
34
|
instructions.map do |instruction|
|
35
35
|
name = instruction["entity"]
|
36
|
-
entity = name
|
36
|
+
entity = entity_for_entity_name name
|
37
37
|
|
38
38
|
query =
|
39
39
|
if pivot_name = instruction["pivot"]
|
@@ -47,7 +47,7 @@ module Optic
|
|
47
47
|
# an INNER JOIN selecting from the entity table and then
|
48
48
|
# selecting every possible pivot value as a UNION, throwing out
|
49
49
|
# the duplicates.
|
50
|
-
pivot = pivot_name
|
50
|
+
pivot = entity_for_entity_name pivot_name
|
51
51
|
join_path = instruction["join_path"]
|
52
52
|
joins = join_path.reverse.map(&:to_sym).inject { |acc, elt| { elt => acc } }
|
53
53
|
|
@@ -96,6 +96,10 @@ module Optic
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
def entity_for_entity_name(entity_name)
|
100
|
+
entity_name.constantize.unscoped
|
101
|
+
end
|
102
|
+
|
99
103
|
def qualified_column(entity, attribute)
|
100
104
|
%Q|"#{entity.table_name}"."#{attribute}"|
|
101
105
|
end
|
data/lib/optic/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optic-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Vaynshtok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: action_cable_client
|