Sha256: 3c2e3f43d32ec6f95a16120ddb676e315287ee67ef6f72532127e6ee33eef9ae

Contents?: true

Size: 882 Bytes

Versions: 22

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

module Switchman
  module Arel
    module Table
      def model
        type_caster.model
      end
    end
    module Visitors
      module ToSql
        def visit_Arel_Nodes_TableAlias *args
          o, collector = args
          collector = visit o.relation, collector
          collector << " "
          collector << quote_local_table_name(o.name)
        end

        def visit_Arel_Attributes_Attribute *args
          o = args.first
          join_name = o.relation.table_alias || o.relation.name
          result = "#{quote_local_table_name join_name}.#{quote_column_name o.name}"
          result = args.last << result
          result
        end

        def quote_local_table_name name
          return name if ::Arel::Nodes::SqlLiteral === name
          @connection.quote_local_table_name(name)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
switchman-2.2.3 lib/switchman/arel.rb
switchman-2.2.2 lib/switchman/arel.rb
switchman-2.2.1 lib/switchman/arel.rb
switchman-2.2.0 lib/switchman/arel.rb
switchman-2.1.6 lib/switchman/arel.rb
switchman-2.1.5 lib/switchman/arel.rb
switchman-2.1.4 lib/switchman/arel.rb
switchman-2.1.3 lib/switchman/arel.rb
switchman-2.1.2 lib/switchman/arel.rb
switchman-2.1.1 lib/switchman/arel.rb
switchman-2.1.0 lib/switchman/arel.rb
switchman-2.0.13 lib/switchman/arel.rb
switchman-2.0.12 lib/switchman/arel.rb
switchman-2.0.11 lib/switchman/arel.rb
switchman-2.0.10 lib/switchman/arel.rb
switchman-2.0.9 lib/switchman/arel.rb
switchman-2.0.8 lib/switchman/arel.rb
switchman-2.0.7 lib/switchman/arel.rb
switchman-2.0.6 lib/switchman/arel.rb
switchman-2.0.5 lib/switchman/arel.rb