diff options
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r-- | lib/arel/nodes/count.rb | 12 | ||||
-rw-r--r-- | lib/arel/nodes/sql_literal.rb | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/arel/nodes/count.rb b/lib/arel/nodes/count.rb new file mode 100644 index 0000000000..b7c4b60948 --- /dev/null +++ b/lib/arel/nodes/count.rb @@ -0,0 +1,12 @@ +module Arel + module Nodes + class Count + attr_accessor :expressions, :distinct + + def initialize expr, distinct = false + @expressions = expr + @distinct = distinct + end + end + end +end diff --git a/lib/arel/nodes/sql_literal.rb b/lib/arel/nodes/sql_literal.rb index 53ff376071..526d088449 100644 --- a/lib/arel/nodes/sql_literal.rb +++ b/lib/arel/nodes/sql_literal.rb @@ -1,6 +1,9 @@ module Arel module Nodes class SqlLiteral < String + def count distinct = false + Count.new [self], distinct + end end end end |