1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

supporting StringJoin in the JoinSQL visitor

This commit is contained in:
Aaron Patterson 2010-09-12 15:45:59 -07:00
parent 12ff6e1349
commit 14ad563ee1
3 changed files with 14 additions and 0 deletions

View file

@ -98,6 +98,7 @@ module Arel
alias :visit_Arel_SqlLiteral :visit_String
alias :visit_Fixnum :visit_String
alias :visit_Symbol :visit_String
alias :visit_Arel_Nodes_SqlLiteral :visit_String
def visit_Hash o
o.each_with_index do |pair, i|

View file

@ -13,6 +13,10 @@ module Arel
o.froms.grep(Nodes::Join).map { |x| visit x }.join ', '
end
def visit_Arel_Nodes_StringJoin o
visit o.right
end
def visit_Arel_Nodes_OuterJoin o
"OUTER JOIN #{visit o.right} #{visit o.constraint}"
end

View file

@ -223,6 +223,15 @@ module Arel
}
check manager.joins(manager).should == manager.join_sql
end
it 'returns string join sql' do
table = Table.new :users
aliaz = table.alias
manager = Arel::SelectManager.new Table.engine
manager.from Nodes::StringJoin.new(table, 'hello')
manager.join_sql.should be_like %{ 'hello' }
check manager.joins(manager).should == manager.join_sql
end
end
describe 'order_clauses' do