aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/max.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-08 15:08:00 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-08 15:08:00 -0700
commit7b122f9a336c8c780dcc5a29074f17f3ec493dc6 (patch)
treef1d76bf30258e0413d9ac032493225f3c4fdaddb /lib/arel/nodes/max.rb
parent301dfa5a3888a41ea36324a390241538249e9a53 (diff)
downloadrails-7b122f9a336c8c780dcc5a29074f17f3ec493dc6.tar.gz
rails-7b122f9a336c8c780dcc5a29074f17f3ec493dc6.tar.bz2
rails-7b122f9a336c8c780dcc5a29074f17f3ec493dc6.zip
adding maximum nodes
Diffstat (limited to 'lib/arel/nodes/max.rb')
-rw-r--r--lib/arel/nodes/max.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/arel/nodes/max.rb b/lib/arel/nodes/max.rb
new file mode 100644
index 0000000000..1766c56058
--- /dev/null
+++ b/lib/arel/nodes/max.rb
@@ -0,0 +1,22 @@
+module Arel
+ module Nodes
+ class Max
+ attr_accessor :expressions, :alias
+
+ def initialize expr, aliaz = nil
+ @expressions = expr
+ @alias = aliaz
+ end
+
+ def as aliaz
+ self.alias = SqlLiteral.new(aliaz)
+ self
+ end
+
+ def to_sql
+ viz = Visitors::ToSql.new Table.engine
+ viz.accept self
+ end
+ end
+ end
+end