From 8f6752ef6e4c5ab0aaafad8c543f9925a7b33774 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 7 Dec 2010 15:05:51 -0800 Subject: get from values out of the select manager --- lib/arel/select_manager.rb | 4 ++++ test/test_select_manager.rb | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index bbe41ac4f1..30495fc8d0 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -79,6 +79,10 @@ module Arel self end + def froms + @ast.cores.map { |x| x.from }.compact + end + def join relation, klass = Nodes::InnerJoin return self unless relation diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index 2b88022ca3..672b5ea78d 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -277,6 +277,11 @@ module Arel end end + it 'should hand back froms' do + relation = Arel::SelectManager.new Table.engine + assert_equal [], relation.froms + end + it 'should create join nodes' do relation = Arel::SelectManager.new Table.engine join = relation.create_join 'foo', 'bar', 'baz' -- cgit v1.2.3