@@ -50,9 +50,7 @@ def remove_foreign_key(to_table = nil, **options)
50
50
51
51
private
52
52
def compatible_table_definition ( t )
53
- class << t
54
- prepend TableDefinition
55
- end
53
+ t . singleton_class . prepend ( TableDefinition )
56
54
super
57
55
end
58
56
end
@@ -180,9 +178,7 @@ def add_foreign_key(from_table, to_table, **options)
180
178
181
179
private
182
180
def compatible_table_definition ( t )
183
- class << t
184
- prepend TableDefinition
185
- end
181
+ t . singleton_class . prepend ( TableDefinition )
186
182
super
187
183
end
188
184
end
@@ -243,9 +239,7 @@ def raise_on_if_exist_options(options)
243
239
244
240
private
245
241
def compatible_table_definition ( t )
246
- class << t
247
- prepend TableDefinition
248
- end
242
+ t . singleton_class . prepend ( TableDefinition )
249
243
super
250
244
end
251
245
end
@@ -286,9 +280,7 @@ def add_reference(table_name, ref_name, **options)
286
280
287
281
private
288
282
def compatible_table_definition ( t )
289
- class << t
290
- prepend TableDefinition
291
- end
283
+ t . singleton_class . prepend ( TableDefinition )
292
284
super
293
285
end
294
286
end
@@ -334,17 +326,13 @@ def add_timestamps(table_name, **options)
334
326
335
327
private
336
328
def compatible_table_definition ( t )
337
- class << t
338
- prepend TableDefinition
339
- end
329
+ t . singleton_class . prepend ( TableDefinition )
340
330
super
341
331
end
342
332
343
333
def command_recorder
344
334
recorder = super
345
- class << recorder
346
- prepend CommandRecorder
347
- end
335
+ recorder . singleton_class . prepend ( CommandRecorder )
348
336
recorder
349
337
end
350
338
end
@@ -432,9 +420,7 @@ def add_reference(table_name, ref_name, **options)
432
420
433
421
private
434
422
def compatible_table_definition ( t )
435
- class << t
436
- prepend TableDefinition
437
- end
423
+ t . singleton_class . prepend ( TableDefinition )
438
424
super
439
425
end
440
426
end
@@ -486,9 +472,7 @@ def remove_index(table_name, column_name = nil, **options)
486
472
487
473
private
488
474
def compatible_table_definition ( t )
489
- class << t
490
- prepend TableDefinition
491
- end
475
+ t . singleton_class . prepend ( TableDefinition )
492
476
super
493
477
end
494
478
0 commit comments