提交 fa0aebf3 编写于 作者: R Rafael Mendonça França

Check if the options value is present before to send the deprecation

message
上级 c449462f
......@@ -629,11 +629,13 @@ def add_index_options(table_name, column_name, options = {})
index_options = options[:where] ? " WHERE #{options[:where]}" : ""
end
else
message = "Passing a string as third argument of `add_index` is deprecated and will" +
" be removed in Rails 4.1." +
" Use add_index(#{table_name.inspect}, #{column_name.inspect}, unique: true) instead"
if options
message = "Passing a string as third argument of `add_index` is deprecated and will" +
" be removed in Rails 4.1." +
" Use add_index(#{table_name.inspect}, #{column_name.inspect}, unique: true) instead"
ActiveSupport::Deprecation.warn message
ActiveSupport::Deprecation.warn message
end
index_type = options
end
......
......@@ -64,7 +64,7 @@ def test_deletes_reference_id_index
remove_reference table_name, :supplier
refute index_exists?(table_name, :supplier_id)
end
def test_does_not_delete_reference_type_column
with_polymorphic_column do
remove_reference table_name, :supplier
......@@ -73,7 +73,7 @@ def test_does_not_delete_reference_type_column
assert column_exists?(table_name, :supplier_type, :string)
end
end
def test_deletes_reference_type_column
with_polymorphic_column do
remove_reference table_name, :supplier, polymorphic: true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册