diff options
author | Aaron Patterson <tenderlove@github.com> | 2019-01-11 11:21:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 11:21:53 -0800 |
commit | 74bef0970fff60eaf5faefde30a23f3c36c0b3ee (patch) | |
tree | 628b6013130e0d2868b2afbac3f00f24629dbb9c /activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | |
parent | 1e923b498492424ae627d7a2c61339148f887503 (diff) | |
parent | 3a1b2a21965c0cd7bcccff586ce04b029eb4c359 (diff) | |
download | rails-74bef0970fff60eaf5faefde30a23f3c36c0b3ee.tar.gz rails-74bef0970fff60eaf5faefde30a23f3c36c0b3ee.tar.bz2 rails-74bef0970fff60eaf5faefde30a23f3c36c0b3ee.zip |
Merge branch 'master' into ac_params_exists
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index 346d4b067a..0d2d66f919 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -504,15 +504,17 @@ module ActiveRecord @connection end - def case_sensitive_comparison(table, attribute, column, value) # :nodoc: - table[attribute].eq(value) + def case_sensitive_comparison(attribute, value) # :nodoc: + attribute.eq(value) end - def case_insensitive_comparison(table, attribute, column, value) # :nodoc: + def case_insensitive_comparison(attribute, value) # :nodoc: + column = column_for_attribute(attribute) + if can_perform_case_insensitive_comparison_for?(column) - table[attribute].lower.eq(table.lower(value)) + attribute.lower.eq(attribute.relation.lower(value)) else - table[attribute].eq(value) + attribute.eq(value) end end @@ -659,6 +661,11 @@ module ActiveRecord raise(ActiveRecordError, "No such column: #{table_name}.#{column_name}") end + def column_for_attribute(attribute) + table_name = attribute.relation.name + schema_cache.columns_hash(table_name)[attribute.name.to_s] + end + def collector if prepared_statements Arel::Collectors::Composite.new( |