diff options
-rw-r--r-- | lib/arel/visitors/oracle.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index ecb157f8bc..fa943b2904 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -10,7 +10,7 @@ module Arel # then can use simple ROWNUM in WHERE clause if o.limit && o.orders.empty? && !o.offset && o.cores.first.projections.first !~ /^DISTINCT / o.cores.last.wheres.push Nodes::LessThanOrEqual.new( - Nodes::SqlLiteral.new('ROWNUM'), o.limit + Nodes::SqlLiteral.new('ROWNUM'), o.limit.expr ) o.limit = nil return super @@ -18,7 +18,7 @@ module Arel if o.limit && o.offset o = o.dup - limit = o.limit.to_i + limit = o.limit.expr.to_i offset = o.offset o.limit = nil o.offset = nil @@ -35,9 +35,9 @@ module Arel if o.limit o = o.dup - limit = o.limit + limit = o.limit.expr o.limit = nil - return "SELECT * FROM (#{super(o)}) WHERE ROWNUM <= #{limit}" + return "SELECT * FROM (#{super(o)}) WHERE ROWNUM <= #{visit limit}" end if o.offset |