aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-02-25 15:19:11 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-25 15:19:11 -0800
commitabffef945a64a32ac959ee11d41593d575bcccab (patch)
tree4a23d5ca695a14debe253e0123add70e5714fced /lib/arel
parent6b021764ff16bbab92f8c27ea8f93f1c8df6bd50 (diff)
downloadrails-abffef945a64a32ac959ee11d41593d575bcccab.tar.gz
rails-abffef945a64a32ac959ee11d41593d575bcccab.tar.bz2
rails-abffef945a64a32ac959ee11d41593d575bcccab.zip
Adding SelectManager#limit= and removing limit nodes when nil is assigned to limit
Diffstat (limited to 'lib/arel')
-rw-r--r--lib/arel/select_manager.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index adffcca764..37405b4596 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -172,10 +172,16 @@ module Arel
end
def take limit
- @ast.limit = Nodes::Limit.new(limit)
- @ctx.top = Nodes::Top.new(limit)
+ if limit
+ @ast.limit = Nodes::Limit.new(limit)
+ @ctx.top = Nodes::Top.new(limit)
+ else
+ @ast.limit = nil
+ @ctx.top = nil
+ end
self
end
+ alias limit= take
def join_sql
return nil if @ctx.source.right.empty?