diff options
author | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2014-05-04 22:32:07 +0530 |
---|---|---|
committer | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2014-05-04 22:32:07 +0530 |
commit | 5e803138a1d8af27319110a2d71239c01421de79 (patch) | |
tree | ff9e13a2bac454ab8a0c9523688373ed5421bc5c /activerecord/lib | |
parent | 9b2b36fadbe05c395d6d8f51c247e51cb8766d0f (diff) | |
download | rails-5e803138a1d8af27319110a2d71239c01421de79.tar.gz rails-5e803138a1d8af27319110a2d71239c01421de79.tar.bz2 rails-5e803138a1d8af27319110a2d71239c01421de79.zip |
Convert column name to string only once
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 3 |
1 files changed, 2 insertions, 1 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 aa99822389..ffa6af6d99 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -71,7 +71,8 @@ module ActiveRecord # column_exists?(:suppliers, :tax, :decimal, precision: 8, scale: 2) # def column_exists?(table_name, column_name, type = nil, options = {}) - columns(table_name).any?{ |c| c.name == column_name.to_s && + column_name = column_name.to_s + columns(table_name).any?{ |c| c.name == column_name && (!type || c.type == type) && (!options.key?(:limit) || c.limit == options[:limit]) && (!options.key?(:precision) || c.precision == options[:precision]) && |