torque-postgresql 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/torque/postgresql/inheritance.rb +13 -11
- data/lib/torque/postgresql/railtie.rb +1 -4
- data/lib/torque/postgresql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6203ba248c069201c1d114d03f01f2c2a333e489
|
4
|
+
data.tar.gz: ac1dd3b305e581641d337ad932a3875c33ae8561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42fdfd545d99a870a7d14274f82dd9143d33b5d78006f96b4e7266f39f0d8fa61841abb55137d1386b34d5784141d73c774e8cd4ce65c36313974eba9e392bbc
|
7
|
+
data.tar.gz: fe901d2160afb65578f2bb320e6f0b2f9a6e956a30328ef82d5243a8abbb9a3638313ffd63fcd2de8c96c32e6580fc163ff2097a775293ed11f0adbc34952ec4
|
@@ -28,17 +28,6 @@ module Torque
|
|
28
28
|
|
29
29
|
delegate :_auto_cast_attribute, :_record_class_attribute, to: ActiveRecord::Relation
|
30
30
|
|
31
|
-
# Manually set the model name associated with tables name in order to
|
32
|
-
# facilitates the identification of inherited records
|
33
|
-
def inherited(subclass)
|
34
|
-
super
|
35
|
-
|
36
|
-
return unless Torque::PostgreSQL.config.eager_load &&
|
37
|
-
!subclass.abstract_class?
|
38
|
-
|
39
|
-
connection.schema_cache.add_model_name(table_name, subclass)
|
40
|
-
end
|
41
|
-
|
42
31
|
# Get a full list of all attributes from a model and all its dependents
|
43
32
|
def inheritance_merged_attributes
|
44
33
|
@inheritance_merged_attributes ||= begin
|
@@ -74,6 +63,19 @@ module Torque
|
|
74
63
|
end.to_h
|
75
64
|
end
|
76
65
|
|
66
|
+
# Manually set the model name associated with tables name in order to
|
67
|
+
# facilitates the identification of inherited records
|
68
|
+
def reset_table_name
|
69
|
+
table = super
|
70
|
+
|
71
|
+
adapter = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
72
|
+
if Torque::PostgreSQL.config.eager_load && connection.is_a?(adapter)
|
73
|
+
connection.schema_cache.add_model_name(table, self)
|
74
|
+
end
|
75
|
+
|
76
|
+
table
|
77
|
+
end
|
78
|
+
|
77
79
|
# Get the final decorated table, regardless of any special condition
|
78
80
|
def decorated_table_name
|
79
81
|
if parent < Base && !parent.abstract_class?
|
@@ -3,11 +3,8 @@ module Torque
|
|
3
3
|
# = Torque PostgreSQL Railtie
|
4
4
|
class Railtie < Rails::Railtie # :nodoc:
|
5
5
|
|
6
|
-
# Eger load PostgreSQL namespace
|
7
|
-
config.eager_load_namespaces << Torque::PostgreSQL
|
8
|
-
|
9
6
|
# Get information from the running rails app
|
10
|
-
|
7
|
+
initializer 'torque-postgresql' do |app|
|
11
8
|
Torque::PostgreSQL.config.eager_load = app.config.eager_load
|
12
9
|
end
|
13
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torque-postgresql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|