aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.markdown2
-rw-r--r--lib/arel/select_manager.rb1
-rw-r--r--test/test_select_manager.rb6
3 files changed, 8 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index ca9dd5a29a..75b0b3ee0b 100644
--- a/README.markdown
+++ b/README.markdown
@@ -206,7 +206,7 @@ users.
When your query is too complex for `Arel`, you can use `Arel::SqlLiteral`:
```ruby
-photo_clicks =Arel::Nodes::SqlLiteral.new(<<-SQL
+photo_clicks = Arel::Nodes::SqlLiteral.new(<<-SQL
CASE WHEN condition1 THEN calculation1
WHEN condition2 THEN calculation2
WHEN condition3 THEN calculation3
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index 0bcffba680..f1dde6403a 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -152,6 +152,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 5662bc8990..09608ea71e 100644
--- a/test/test_select_manager.rb
+++ b/test/test_select_manager.rb
@@ -1095,6 +1095,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