From ac2bdd1dd31c8b89578ae7f490a898838b9ef6e0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 10 Sep 2010 09:47:50 -0700 Subject: adding an offset node --- lib/arel/visitors/to_sql.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/arel/visitors') diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 25b7f005ea..d45253abd5 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -52,6 +52,7 @@ module Arel o.cores.map { |x| visit x }.join, ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?), ("LIMIT #{o.limit}" if o.limit), + (visit(o.offset) if o.offset), (visit(o.lock) if o.lock), ].compact.join ' ' end @@ -70,6 +71,10 @@ module Arel "HAVING #{visit o.expr}" end + def visit_Arel_Nodes_Offset o + "OFFSET #{visit o.value}" + end + # FIXME: this does nothing on SQLLite3, but should do things on other # databases. def visit_Arel_Nodes_Lock o -- cgit v1.2.3