File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -782,6 +782,11 @@ def load_schema!
782
782
system ( "bin/rails db:test:prepare" )
783
783
end
784
784
end
785
+
786
+ def respond_to_missing? ( method , include_private = false )
787
+ return false if nearest_delegate == delegate
788
+ nearest_delegate . respond_to? ( method , include_private )
789
+ end
785
790
end
786
791
787
792
def disable_ddl_transaction # :nodoc:
@@ -1170,6 +1175,10 @@ def internal_option?(option_name)
1170
1175
def command_recorder
1171
1176
CommandRecorder . new ( connection )
1172
1177
end
1178
+
1179
+ def respond_to_missing? ( method , include_private = false )
1180
+ execution_strategy . respond_to? ( method , include_private ) || super
1181
+ end
1173
1182
end
1174
1183
1175
1184
# MigrationProxy is used to defer loading of the actual migration classes
Original file line number Diff line number Diff line change @@ -461,6 +461,21 @@ def create_table; "hi mom!"; end
461
461
assert_equal "hi mom!" , migration . method_missing ( :create_table )
462
462
end
463
463
464
+ def test_respond_to_for_migration_method
465
+ migration_class = Class . new ( ActiveRecord ::Migration ::Current ) {
466
+ def connection
467
+ Class . new {
468
+ def create_table ; end
469
+ } . new
470
+ end
471
+ }
472
+
473
+ migration_class . class_eval { undef_method :create_table }
474
+ # create_table is handled by method_missing, so respond_to? returns true.
475
+ assert migration_class . new . respond_to? ( :create_table )
476
+ assert migration_class . respond_to? ( :create_table )
477
+ end
478
+
464
479
def test_add_table_with_decimals
465
480
Person . lease_connection . drop_table :big_numbers rescue nil
466
481
You can’t perform that action at this time.
0 commit comments