diff options
-rw-r--r-- | lib/arel/factory_methods.rb | 4 | ||||
-rw-r--r-- | test/test_table.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/arel/factory_methods.rb b/lib/arel/factory_methods.rb index 23d668c8e5..8fcb78069f 100644 --- a/lib/arel/factory_methods.rb +++ b/lib/arel/factory_methods.rb @@ -5,5 +5,9 @@ module Arel def create_join from, to, on = nil, klass = Nodes::InnerJoin klass.new(from, to, on) end + + def create_string_join from, to + create_join from, to, nil, Nodes::StringJoin + end end end diff --git a/test/test_table.rb b/test/test_table.rb index 7d773b2e2b..65454d402b 100644 --- a/test/test_table.rb +++ b/test/test_table.rb @@ -7,6 +7,13 @@ module Arel end it 'should create join nodes' do + join = @relation.create_string_join 'foo', 'bar' + assert_kind_of Arel::Nodes::StringJoin, join + assert_equal 'foo', join.left + assert_equal 'bar', join.right + end + + it 'should create join nodes' do join = @relation.create_join 'foo', 'bar', 'baz' assert_kind_of Arel::Nodes::InnerJoin, join assert_equal 'foo', join.left |