Class: Arel::Sql::TableReference

Inherits:
Formatter show all
Defined in:
lib/arel/engines/sql/formatters.rb

Instance Attribute Summary

Attributes inherited from Formatter

#environment

Instance Method Summary collapse

Methods inherited from Formatter

#initialize

Constructor Details

This class inherits a constructor from Arel::Sql::Formatter

Instance Method Details

#select(select_sql, table) ⇒ Object



95
96
97
# File 'lib/arel/engines/sql/formatters.rb', line 95

def select(select_sql, table)
  "(#{select_sql}) #{quote_table_name(name_for(table))}"
end

#table(table) ⇒ Object



99
100
101
102
103
104
105
106
# File 'lib/arel/engines/sql/formatters.rb', line 99

def table(table)
  if table.name =~ /\s/
    table.name
  else
    quote_table_name(table.name) +
      (table.name != name_for(table) ? " #{quote_table_name(name_for(table))}" : '')
  end
end