Sha256: 73539cb1e2f990d1c9da2ec454a0beb631dd928f94cdf5888dec78dc5cd6109a

Contents?: true

Size: 655 Bytes

Versions: 14

Compression:

Stored size: 655 Bytes

Contents

module Arel
  module Visitors
    class ToSql
      def visit_CompositePrimaryKeys_Nodes_In o, collector
        collector << "("
        visit(o.left, collector)
        collector << ")"
        collector << " IN ("
        visit(o.right, collector) << ")"
      end

      def visit_CompositePrimaryKeys_CompositeKeys o, collector
        values = o.map do |key|
          case key
            when Arel::Attributes::Attribute
              "#{key.relation.name}.#{key.name}"
            else
              key
          end
        end
        collector << "#{values.join(', ')}"
        collector
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
composite_primary_keys-10.0.5 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.10 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-10.0.4 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.9 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-10.0.3 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-10.0.2 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-10.0.1 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.8 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-10.0.0 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.7 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.6 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.5 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.4 lib/composite_primary_keys/arel/to_sql.rb
composite_primary_keys-9.0.2 lib/composite_primary_keys/arel/to_sql.rb