diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-07 08:30:09 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-07 08:30:09 -0800 |
commit | 8aa5d7a393e0bbef8cd3ae9ecf64c2358b802b5f (patch) | |
tree | 65bf0d13754591494117283ac9b8c076cd5799ea /lib/arel/visitors | |
parent | 2644bcec7dbe3a65277b3a6a141853484171535a (diff) | |
parent | 2158d592c074813471baa8fa20044b683bb156e6 (diff) | |
download | rails-8aa5d7a393e0bbef8cd3ae9ecf64c2358b802b5f.tar.gz rails-8aa5d7a393e0bbef8cd3ae9ecf64c2358b802b5f.tar.bz2 rails-8aa5d7a393e0bbef8cd3ae9ecf64c2358b802b5f.zip |
Merge remote branch 'stiff/master' into omg
* stiff/master:
implemented support for math operations in numeric attributes
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 70e10a5e0f..7eaaff8e13 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -373,6 +373,22 @@ key on UpdateManager using UpdateManager#key= alias :visit_Time :quoted alias :visit_TrueClass :quoted + def visit_Arel_Nodes_Multiplication o + "#{visit o.left} * #{visit o.right}" + end + + def visit_Arel_Nodes_Division o + "#{visit o.left} / #{visit o.right}" + end + + def visit_Arel_Nodes_Addition o + "(#{visit o.left} + #{visit o.right})" + end + + def visit_Arel_Nodes_Subtraction o + "(#{visit o.left} - #{visit o.right})" + end + def visit_Array o o.empty? ? 'NULL' : o.map { |x| visit x }.join(', ') end |