Skip to content
Browse files

GH-138: add Arel::SelectManager#projections method

  • Loading branch information...
1 parent e032dab commit 24ff439eeeef2b9b4ddf1b0ee360e78610fe30c8 Suraj N. Kurapati committed Sep 21, 2012
Showing with 12 additions and 0 deletions.
  1. +4 −0 lib/arel/select_manager.rb
  2. +8 −0 test/test_select_manager.rb
View
4 lib/arel/select_manager.rb
@@ -141,6 +141,10 @@ def project *projections
self
end
+ def projections
+ @ctx.projections
+ end
+
def projections= projections
@ctx.projections = projections
end
View
8 test/test_select_manager.rb
@@ -1033,6 +1033,14 @@ def test_join_sources
end
end
+ describe 'projections' do
+ it 'reads projections' do
+ manager = Arel::SelectManager.new Table.engine
+ manager.project Arel.sql('foo'), Arel.sql('bar')
+ manager.projections.must_equal [Arel.sql('foo'), Arel.sql('bar')]
+ end
+ end
+
describe 'projections=' do
it 'overwrites projections' do
manager = Arel::SelectManager.new Table.engine

0 comments on commit 24ff439

Please sign in to comment.
Something went wrong with that request. Please try again.