diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-07 15:05:51 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-07 15:05:51 -0800 |
commit | 8f6752ef6e4c5ab0aaafad8c543f9925a7b33774 (patch) | |
tree | fa471f2b5f5fd9f16d392a0c551409b3b9bf6a26 | |
parent | dfc66f44218aa2ef2bd768000fd6e83b4fd8c96a (diff) | |
download | rails-8f6752ef6e4c5ab0aaafad8c543f9925a7b33774.tar.gz rails-8f6752ef6e4c5ab0aaafad8c543f9925a7b33774.tar.bz2 rails-8f6752ef6e4c5ab0aaafad8c543f9925a7b33774.zip |
get from values out of the select manager
-rw-r--r-- | lib/arel/select_manager.rb | 4 | ||||
-rw-r--r-- | test/test_select_manager.rb | 5 |
2 files changed, 9 insertions, 0 deletions
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' |