aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb10
-rw-r--r--activerecord/test/cases/migration/references_statements_test.rb4
2 files changed, 8 insertions, 6 deletions
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 73aaffc146..17dd71e898 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -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
diff --git a/activerecord/test/cases/migration/references_statements_test.rb b/activerecord/test/cases/migration/references_statements_test.rb
index 144302bd4a..d8a6565d54 100644
--- a/activerecord/test/cases/migration/references_statements_test.rb
+++ b/activerecord/test/cases/migration/references_statements_test.rb
@@ -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