Permalink
Browse files

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

message
  • Loading branch information...
rafaelfranca committed Nov 3, 2012
1 parent c449462 commit fa0aebf320995a598c5bffda729aed4429681f3a
@@ -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

0 comments on commit fa0aebf

Please sign in to comment.