mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Check if the options value is present before to send the deprecation
message
This commit is contained in:
parent
c449462f45
commit
fa0aebf320
2 changed files with 8 additions and 6 deletions
|
@ -629,11 +629,13 @@ module ActiveRecord
|
|||
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 @@ module ActiveRecord
|
|||
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 @@ module ActiveRecord
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue