From acdd8e4f08e230926a7174903cf905e8a415a1d4 Mon Sep 17 00:00:00 2001 From: Jordan Sexton Date: Tue, 6 May 2014 15:38:26 -0500 Subject: Return self from #distinct so it's chainable --- lib/arel/select_manager.rb | 1 + test/test_select_manager.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index fe0d26a16e..7ec9fdba79 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -151,6 +151,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 -- cgit v1.2.3