@@ -14,25 +14,25 @@ def has_closure_tree(options = {})
14
14
:with_advisory_lock
15
15
)
16
16
17
- class_attribute :_ct
18
- self . _ct = ClosureTree ::Support . new ( self , options )
17
+ connection_pool . with_connection {
18
+ class_attribute :_ct
19
+ self . _ct = ClosureTree ::Support . new ( self , options )
19
20
20
- # Auto-inject the hierarchy table
21
- # See https://github.com/patshaughnessy/class_factory/blob/master/lib/class_factory/class_factory.rb
22
- class_attribute :hierarchy_class
23
- self . hierarchy_class = _ct . hierarchy_class_for_model
21
+ # Auto-inject the hierarchy table
22
+ # See https://github.com/patshaughnessy/class_factory/blob/master/lib/class_factory/class_factory.rb
23
+ class_attribute :hierarchy_class
24
+ self . hierarchy_class = _ct . hierarchy_class_for_model
24
25
25
- # tests fail if you include Model before HierarchyMaintenance wtf
26
- include ClosureTree ::HierarchyMaintenance
27
- include ClosureTree ::Model
28
- include ClosureTree ::Finders
29
- include ClosureTree ::HashTree
30
- include ClosureTree ::Digraphs
26
+ # tests fail if you include Model before HierarchyMaintenance wtf
27
+ include ClosureTree ::HierarchyMaintenance
28
+ include ClosureTree ::Model
29
+ include ClosureTree ::Finders
30
+ include ClosureTree ::HashTree
31
+ include ClosureTree ::Digraphs
31
32
32
- include ClosureTree ::DeterministicOrdering if _ct . order_option?
33
- include ClosureTree ::NumericDeterministicOrdering if _ct . order_is_numeric?
34
-
35
- connection_pool . release_connection
33
+ include ClosureTree ::DeterministicOrdering if _ct . order_option?
34
+ include ClosureTree ::NumericDeterministicOrdering if _ct . order_is_numeric?
35
+ }
36
36
rescue StandardError => e
37
37
raise e unless ClosureTree . configuration . database_less
38
38
end
0 commit comments