diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-08 21:35:23 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-08 21:35:23 -0700 |
commit | eba73dcbd505ce9b2ed28dc487e02046f1d9c257 (patch) | |
tree | 9c90074099279d6d537177cdc246e21281ef0ac2 /lib/arel/visitors/to_sql.rb | |
parent | ba577e539f585fd09dc96d70527b5f94e35b2971 (diff) | |
download | rails-eba73dcbd505ce9b2ed28dc487e02046f1d9c257.tar.gz rails-eba73dcbd505ce9b2ed28dc487e02046f1d9c257.tar.bz2 rails-eba73dcbd505ce9b2ed28dc487e02046f1d9c257.zip |
fixing OVER
Diffstat (limited to 'lib/arel/visitors/to_sql.rb')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 2c460ed4ba..7b0d6e2de1 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -377,16 +377,16 @@ module Arel collector << "CURRENT ROW" end - def visit_Arel_Nodes_Over o + def visit_Arel_Nodes_Over o, collector case o.right - when nil - "#{visit o.left} OVER ()" - when Arel::Nodes::SqlLiteral - "#{visit o.left} OVER #{visit o.right}" - when String, Symbol - "#{visit o.left} OVER #{quote_column_name o.right.to_s}" - else - "#{visit o.left} OVER #{visit o.right}" + when nil + visit(o.left, collector) << " OVER ()" + when Arel::Nodes::SqlLiteral + infix_value o, collector, " OVER " + when String, Symbol + visit(o.left, collector) << " OVER #{quote_column_name o.right.to_s}" + else + infix_value o, collector, " OVER " end end |