diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-19 07:59:12 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-19 07:59:12 -0300 |
commit | f6ab8cf4bb3040d7244d58729cb44f412bd1c40a (patch) | |
tree | 4fdd5a16f0cbe370af74064b5a4663a04fa3a6a0 | |
parent | be9963ac233430b70b94277d8f1d472251b88217 (diff) | |
parent | acdd8e4f08e230926a7174903cf905e8a415a1d4 (diff) | |
download | rails-f6ab8cf4bb3040d7244d58729cb44f412bd1c40a.tar.gz rails-f6ab8cf4bb3040d7244d58729cb44f412bd1c40a.tar.bz2 rails-f6ab8cf4bb3040d7244d58729cb44f412bd1c40a.zip |
Merge pull request #267 from jordansexton/patch-1
Return self from distinct so it's chainable
-rw-r--r-- | lib/arel/select_manager.rb | 1 | ||||
-rw-r--r-- | test/test_select_manager.rb | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index 804316209c..bb7b1f5b66 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -148,6 +148,7 @@ module Arel else @ctx.set_quantifier = nil end + self end def order *expr diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index 837486fb46..611bba10c2 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -1073,6 +1073,12 @@ module Arel manager.distinct(false) manager.ast.cores.last.set_quantifier.must_equal nil end + + it "chains" do + manager = Arel::SelectManager.new Table.engine + manager.distinct.must_equal manager + manager.distinct(false).must_equal manager + end end end end |