    # File lib/active_record/base.rb, line 2297
            def sanitize_sql_hash_for_conditions(attrs, default_table_name = quoted_table_name)
              attrs = expand_hash_conditions_for_aggregates(attrs)

              conditions = attrs.map do |attr, value|
                table_name = default_table_name

                unless value.is_a?(Hash)
                  attr = attr.to_s

                  # Extract table name from qualified attribute names.
                  if attr.include?('.')
                    attr_table_name, attr = attr.split('.', 2)
                    attr_table_name = connection.quote_table_name(attr_table_name)
                  else
                    attr_table_name = table_name
                  end

                  attribute_condition("#{attr_table_name}.#{connection.quote_column_name(attr)}", value)
                else
                  sanitize_sql_hash_for_conditions(value, connection.quote_table_name(attr.to_s))
                end
              end.join(' AND ')

              replace_bind_variables(conditions, expand_range_bind_variables(attrs.values))
            end