optic-rails 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a31dc5831c0497221df21911c8b1d3e19823e8757571fb543530d78649c1d836
4
- data.tar.gz: 0d8d44c7978a12e9f5b0fc5da2bb6b1e7c1dfb8c9868bb66abb5814b78218c02
3
+ metadata.gz: 9c86b9eac93434bd8297c433d5f10c4c1827e4905cf4c7d6e62fe5f4c3ee6fec
4
+ data.tar.gz: 2c15c7a1cb011386bc64f632af5b49b571289773195f44dedc3fced6d78ea65c
5
5
  SHA512:
6
- metadata.gz: b3a385d803cfd40bff67dddf437c69857fc08a0bee5ac9d71e096239ddd3c5f7ffc4a4d0d17482404bce939f930af1ff20af0f8bc44deb194bee74b527988394
7
- data.tar.gz: b5b7c3c6a8c1c8fba53981cbd30144a9991350501784605e52e530e8b7e19419370371f854c38ea214c350b079e22745b3aabdf8db20c74741520bbf55193a5e
6
+ metadata.gz: 1c35b4031d5c8c6ca5aa4e1e10d7955c5db635d29208bcfe7e69042cd3586bb9e65b2382935525c209ee9262dce93538d71ebcd31dc98ac1ab3a0805f6b06f34
7
+ data.tar.gz: 01432f5d8f521e78d12c60e2e4e686cbf95b6c4995f1fb5366d9293236527affbd6c117020dda37df3c806e977a49106c9bf6973b1acfeb0dfc4c7ab34ef8ebd
@@ -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.constantize.unscoped
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.constantize
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Optic
4
4
  module Rails
5
- VERSION = "1.3.0"
5
+ VERSION = "1.3.1"
6
6
  end
7
7
  end
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.0
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-02 00:00:00.000000000 Z
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