diff options
-rw-r--r-- | lib/arel/select_manager.rb | 4 | ||||
-rw-r--r-- | test/test_select_manager.rb | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index cff3236a33..88f26e4894 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -224,6 +224,10 @@ module Arel @ctx.source.right end + def source + @ctx.source + end + def joins manager if $VERBOSE warn "joins is deprecated and will be removed in 3.0.0" diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index ada0f1423d..6603102a3a 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -956,5 +956,13 @@ module Arel manager.to_sql.must_be_like 'SELECT "users"."id" FROM "users"' end end + + describe 'source' do + it 'returns the join source of the select core' do + table = Table.new :users + manager = Arel::SelectManager.new Table.engine + manager.source.must_equal manager.ast.cores.last.source + end + end end end |