aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-03 13:26:21 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-11-03 13:27:08 -0200
commitfa0aebf320995a598c5bffda729aed4429681f3a (patch)
tree429dc9fe708695fb1103ad69e20bb9ffa20ddccc /activerecord/lib
parentc449462f45d342258a01313c0ff46279d268719d (diff)
downloadrails-fa0aebf320995a598c5bffda729aed4429681f3a.tar.gz
rails-fa0aebf320995a598c5bffda729aed4429681f3a.tar.bz2
rails-fa0aebf320995a598c5bffda729aed4429681f3a.zip
Check if the options value is present before to send the deprecation
message
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb10
1 files changed, 6 insertions, 4 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