aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-05 11:58:29 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-05-05 11:58:29 -0300
commita8f4a49e374672209f7716b528d7a30d1c327768 (patch)
treefee6c79ab9ab0d62be9ae13b1c959d4716ac3bc0
parente7461065c5dc79191f98027efbf9a65dcd84f7b1 (diff)
parent801a1516d0a219ce530a45f0a2e65a35b04c30eb (diff)
downloadrails-a8f4a49e374672209f7716b528d7a30d1c327768.tar.gz
rails-a8f4a49e374672209f7716b528d7a30d1c327768.tar.bz2
rails-a8f4a49e374672209f7716b528d7a30d1c327768.zip
Merge pull request #266 from yahonda/address_undefined_to_i_oracle
Support to add the casting node to the AST at build time to oracle
-rw-r--r--lib/arel/visitors/oracle.rb2
-rw-r--r--test/visitors/test_oracle.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb
index 699b52fe9a..8a80faaa97 100644
--- a/lib/arel/visitors/oracle.rb
+++ b/lib/arel/visitors/oracle.rb
@@ -17,7 +17,7 @@ module Arel
if o.limit && o.offset
o = o.dup
- limit = o.limit.expr.to_i
+ limit = o.limit.expr.expr
offset = o.offset
o.offset = nil
collector << "
diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb
index bb0fe404e8..9111a266cf 100644
--- a/test/visitors/test_oracle.rb
+++ b/test/visitors/test_oracle.rb
@@ -100,7 +100,7 @@ module Arel
it 'creates a different subquery when there is an offset' do
stmt = Nodes::SelectStatement.new
- stmt.limit = Nodes::Limit.new(10)
+ stmt.limit = Nodes::Limit.new(Nodes.build_quoted(10))
stmt.offset = Nodes::Offset.new(10)
sql = compile stmt
sql.must_be_like %{
@@ -115,7 +115,7 @@ module Arel
it 'is idempotent with different subquery' do
stmt = Nodes::SelectStatement.new
- stmt.limit = Nodes::Limit.new(10)
+ stmt.limit = Nodes::Limit.new(Nodes.build_quoted(10))
stmt.offset = Nodes::Offset.new(10)
sql = compile stmt
sql2 = compile stmt