Repository: rails/rails
File: activerecord/lib/arel/visitors/to_sql.rb (Ruby)

Code before:
          end

          visit o.relation, collector
        end

        def visit_Arel_Attributes_Attribute(o, collector)
          join_name = o.relation.table_alias || o.relation.name
          collector << quote_table_name(join_name) << "." << quote_column_name(o.name)
        end

        BIND_BLOCK = proc { "?" }
        private_constant :BIND_BLOCK

        def bind_block; BIND_BLOCK; end

        def visit_ActiveModel_Attribute(o, collector)
          collector.add_bind(o, &bind_block)
        end

        def visit_Arel_Nodes_BindParam(o, collector)
          collector.add_bind(o.value, &bind_block)
        end

        def visit_Arel_Nodes_SqlLiteral(o, collector)
          collector.preparable = false
          collector.retryable = false unless o.retryable
          collector << o.to_s
        end

        def visit_Arel_Nodes_BoundSqlLiteral(o, collector)
          collector.retryable = false
          bind_index = 0

          new_bind = lambda do |value|
            if Arel.arel_node?(value)
              visit value, collector
            elsif value.is_a?(Array)
              if value.empty?
                collector << @connection.quote(nil)
              else
                if value.none? { |v| Arel.arel_node?(v) }
                  collector.add_binds(value.map { |v| @connection.cast_bound_value(v) }, &bind_block)
                else
                  value.each_with_index do |v, i|
                    collector << ", " unless i == 0
                    if Arel.arel_node?(v)
                      visit v, collector
                    else
                      collector.add_bind(@connection.cast_bound_value(v), &bind_block)
                    end
                  end

Review comment (suggestion):
```suggestion
          collector.retryable &&= o.retryable
```

Just style I guess.

Code after:
          end

          visit o.relation, collector
        end

        def visit_Arel_Attributes_Attribute(o, collector)
          join_name = o.relation.table_alias || o.relation.name
          collector << quote_table_name(join_name) << "." << quote_column_name(o.name)
        end

        BIND_BLOCK = proc { "?" }
        private_constant :BIND_BLOCK

        def bind_block; BIND_BLOCK; end

        def visit_ActiveModel_Attribute(o, collector)
          collector.add_bind(o, &bind_block)
        end

        def visit_Arel_Nodes_BindParam(o, collector)
          collector.add_bind(o.value, &bind_block)
        end

        def visit_Arel_Nodes_SqlLiteral(o, collector)
          collector.preparable = false
          collector.retryable &&= o.retryable
          collector << o.to_s
        end

        def visit_Arel_Nodes_BoundSqlLiteral(o, collector)
          collector.retryable = false
          bind_index = 0

          new_bind = lambda do |value|
            if Arel.arel_node?(value)
              visit value, collector
            elsif value.is_a?(Array)
              if value.empty?
                collector << @connection.quote(nil)
              else
                if value.none? { |v| Arel.arel_node?(v) }
                  collector.add_binds(value.map { |v| @connection.cast_bound_value(v) }, &bind_block)
                else
                  value.each_with_index do |v, i|
                    collector << ", " unless i == 0
                    if Arel.arel_node?(v)
                      visit v, collector
                    else
                      collector.add_bind(@connection.cast_bound_value(v), &bind_block)
                    end
                  end