1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix add_foreign_key to prevent double prefix/suffix

This commit is contained in:
Ryuta Kamizono 2021-05-03 13:38:29 +09:00
parent dd5886d00a
commit 6951566f36

View file

@ -921,7 +921,7 @@ module ActiveRecord
unless connection.respond_to? :revert unless connection.respond_to? :revert
unless arguments.empty? || [:execute, :enable_extension, :disable_extension].include?(method) unless arguments.empty? || [:execute, :enable_extension, :disable_extension].include?(method)
arguments[0] = proper_table_name(arguments.first, table_name_options) arguments[0] = proper_table_name(arguments.first, table_name_options)
if [:rename_table, :add_foreign_key].include?(method) || if method == :rename_table ||
(method == :remove_foreign_key && !arguments.second.is_a?(Hash)) (method == :remove_foreign_key && !arguments.second.is_a?(Hash))
arguments[1] = proper_table_name(arguments.second, table_name_options) arguments[1] = proper_table_name(arguments.second, table_name_options)
end end