Skip to content

Commit

Permalink
Merge pull request #267 from jordansexton/patch-1
Browse files Browse the repository at this point in the history
Return self from distinct so it's chainable
  • Loading branch information
rafaelfranca committed May 19, 2014
2 parents be9963a + acdd8e4 commit f6ab8cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/arel/select_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def distinct(value = true)
else
@ctx.set_quantifier = nil
end
self
end

def order *expr
Expand Down
6 changes: 6 additions & 0 deletions test/test_select_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,12 @@ def test_manager_stores_bind_values
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

0 comments on commit f6ab8cf

Please sign in to comment.