Sha256: b4f949bab3d8f3480a0ddd2ade7c5fa996cd90fa95f74efbda38b4e787c2c433

Contents?: true

Size: 929 Bytes

Versions: 23

Compression:

Stored size: 929 Bytes

Contents

module Switchman
  module Arel
    module Table
      def model
        if ::Rails.version >= '5'
          type_caster.model
        else
          engine
        end
      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

23 entries across 23 versions & 1 rubygems

Version Path
switchman-1.10.4 lib/switchman/arel.rb
switchman-1.10.3 lib/switchman/arel.rb
switchman-1.10.2 lib/switchman/arel.rb
switchman-1.9.14 lib/switchman/arel.rb
switchman-1.10.1 lib/switchman/arel.rb
switchman-1.9.13 lib/switchman/arel.rb
switchman-1.10.0 lib/switchman/arel.rb
switchman-1.9.12 lib/switchman/arel.rb
switchman-1.9.11 lib/switchman/arel.rb
switchman-1.9.10 lib/switchman/arel.rb
switchman-1.9.9 lib/switchman/arel.rb
switchman-1.9.8 lib/switchman/arel.rb
switchman-1.9.7 lib/switchman/arel.rb
switchman-1.9.6 lib/switchman/arel.rb
switchman-1.9.5 lib/switchman/arel.rb
switchman-1.9.4 lib/switchman/arel.rb
switchman-1.9.3 lib/switchman/arel.rb
switchman-1.9.2 lib/switchman/arel.rb
switchman-1.9.1 lib/switchman/arel.rb
switchman-1.9.0 lib/switchman/arel.rb