Browse files

Merge pull request #141 from sunaku/GH-138

feature: add Arel::SelectManager#projections method
  • Loading branch information...
2 parents 0138356 + 24ff439 commit de7e7c84856a628493ab6f14a7ab41f0011cd83f @tenderlove tenderlove committed Sep 24, 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 de7e7c8

Please sign in to comment.