diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-04 11:07:03 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-04 11:58:44 -0300 |
commit | 3a59dd212315ebb9bae8338b98af259ac00bbef3 (patch) | |
tree | 637a1d69a53da1cb7798b0790f76936ed3a0e6ce /activerecord/lib | |
parent | ede8c199a85cfbb6457d5630ec1e285e5ec49313 (diff) | |
download | rails-3a59dd212315ebb9bae8338b98af259ac00bbef3.tar.gz rails-3a59dd212315ebb9bae8338b98af259ac00bbef3.tar.bz2 rails-3a59dd212315ebb9bae8338b98af259ac00bbef3.zip |
Remove deprecated `sanitize_sql_hash_for_conditions`
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/sanitization.rb | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/activerecord/lib/active_record/sanitization.rb b/activerecord/lib/active_record/sanitization.rb index f5aa60a69a..768a72a947 100644 --- a/activerecord/lib/active_record/sanitization.rb +++ b/activerecord/lib/active_record/sanitization.rb @@ -72,35 +72,6 @@ module ActiveRecord expanded_attrs end - # Sanitizes a hash of attribute/value pairs into SQL conditions for a WHERE clause. - # { name: "foo'bar", group_id: 4 } - # # => "name='foo''bar' and group_id= 4" - # { status: nil, group_id: [1,2,3] } - # # => "status IS NULL and group_id IN (1,2,3)" - # { age: 13..18 } - # # => "age BETWEEN 13 AND 18" - # { 'other_records.id' => 7 } - # # => "`other_records`.`id` = 7" - # { other_records: { id: 7 } } - # # => "`other_records`.`id` = 7" - # And for value objects on a composed_of relationship: - # { address: Address.new("123 abc st.", "chicago") } - # # => "address_street='123 abc st.' and address_city='chicago'" - def sanitize_sql_hash_for_conditions(attrs, default_table_name = self.table_name) - table = Arel::Table.new(table_name).alias(default_table_name) - predicate_builder = PredicateBuilder.new(TableMetadata.new(self, table)) - ActiveSupport::Deprecation.warn(<<-EOWARN) -sanitize_sql_hash_for_conditions is deprecated, and will be removed in Rails 5.0 - EOWARN - attrs = predicate_builder.resolve_column_aliases(attrs) - attrs = expand_hash_conditions_for_aggregates(attrs) - - predicate_builder.build_from_hash(attrs).map { |b| - connection.visitor.compile b - }.join(' AND ') - end - alias_method :sanitize_sql_hash, :sanitize_sql_hash_for_conditions - # Sanitizes a hash of attribute/value pairs into SQL conditions for a SET clause. # { status: nil, group_id: 1 } # # => "status = NULL , group_id = 1" |