From 6d1440db3eb77170c461d7dab6d43a978a988fae Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 5 Jun 2016 16:10:09 +0900 Subject: Fix `remove_reference` to multiple foreign keys in the same table --- .../lib/active_record/connection_adapters/abstract/schema_statements.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 8de8c05988..dff84613a8 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -856,6 +856,7 @@ module ActiveRecord else foreign_key_options = { to_table: reference_name } end + foreign_key_options[:column] ||= "#{ref_name}_id" remove_foreign_key(table_name, **foreign_key_options) end -- cgit v1.2.3