File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
class ApplicationRecord < ActiveRecord ::Base
4
4
self . abstract_class = true
5
+
6
+ connects_to database : { writing : :primary , reading : :primary }
5
7
end
6
8
7
9
class SecondDatabaseRecord < ActiveRecord ::Base
8
10
self . abstract_class = true
9
11
10
- establish_connection : secondary
12
+ connects_to database : { writing : : secondary, reading : :secondary }
11
13
end
12
14
13
15
ActiveRecord ::Schema . define ( version : 0 ) do
@@ -151,6 +153,7 @@ class SecondDatabaseRecord < ActiveRecord::Base
151
153
add_foreign_key ( :tag_hierarchies , :tags , column : 'descendant_id' , on_delete : :cascade )
152
154
end
153
155
156
+ SecondDatabaseRecord . establish_connection
154
157
SecondDatabaseRecord . connection_pool . with_connection do |connection |
155
158
ActiveRecord ::Schema . define ( version : 0 ) do
156
159
connection . create_table 'menu_items' , force : :cascade do |t |
You can’t perform that action at this time.
0 commit comments