torque-postgresql 0.2.3 → 0.2.4

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
  SHA1:
3
- metadata.gz: 817639c325ea9e6295c7896a68e3e96c7b4db9a5
4
- data.tar.gz: 7df01edb6d749ff202e18df38a74484ea6be8b9b
3
+ metadata.gz: 6203ba248c069201c1d114d03f01f2c2a333e489
4
+ data.tar.gz: ac1dd3b305e581641d337ad932a3875c33ae8561
5
5
  SHA512:
6
- metadata.gz: 8e3a5f82a6972e5b52e8450224443644bf586024d262df711f351cc853313facad3d273483e22076a866b39406af6968df3c4d6ed35529b59ffc5a06ac14db3b
7
- data.tar.gz: f74a703d96af485d4784af11e63f181f028934b75b23937b20c114b15935b6e712ecff6c389e45023a3af7d5674c801d3349e6c356feb790b6ee9ece6940516b
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
- runner do |app|
7
+ initializer 'torque-postgresql' do |app|
11
8
  Torque::PostgreSQL.config.eager_load = app.config.eager_load
12
9
  end
13
10
 
@@ -1,5 +1,5 @@
1
1
  module Torque
2
2
  module PostgreSQL
3
- VERSION = '0.2.3'
3
+ VERSION = '0.2.4'
4
4
  end
5
5
  end
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.3
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-27 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails