diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-27 14:25:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-27 14:25:01 -0700 |
commit | 593002080cbcbb6e14acf3bc909aab819811f215 (patch) | |
tree | 40c61fb51f9583c7eeaa3a2f6bbb7dedac156af4 | |
parent | 58c3d1d56cf38aebf09e64803441b606680b680a (diff) | |
parent | 00d1482fefa1cf9c3753b58f4fe9b580c52ae935 (diff) | |
download | rails-593002080cbcbb6e14acf3bc909aab819811f215.tar.gz rails-593002080cbcbb6e14acf3bc909aab819811f215.tar.bz2 rails-593002080cbcbb6e14acf3bc909aab819811f215.zip |
Merge pull request #55 from samuelkadolph/add_predicates_to_function_node
Include Arel::Predicates to Arel::Nodes::Function
-rw-r--r-- | lib/arel/nodes/function.rb | 1 | ||||
-rw-r--r-- | lib/arel/nodes/named_function.rb | 2 | ||||
-rw-r--r-- | test/nodes/test_count.rb | 9 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lib/arel/nodes/function.rb b/lib/arel/nodes/function.rb index 85347fc028..b6f6644678 100644 --- a/lib/arel/nodes/function.rb +++ b/lib/arel/nodes/function.rb @@ -2,6 +2,7 @@ module Arel module Nodes class Function < Arel::Nodes::Node include Arel::Expression + include Arel::Predications attr_accessor :expressions, :alias, :distinct def initialize expr, aliaz = nil diff --git a/lib/arel/nodes/named_function.rb b/lib/arel/nodes/named_function.rb index 5fca33e323..56669bf858 100644 --- a/lib/arel/nodes/named_function.rb +++ b/lib/arel/nodes/named_function.rb @@ -3,8 +3,6 @@ module Arel class NamedFunction < Arel::Nodes::Function attr_accessor :name - include Arel::Predications - def initialize name, expr, aliaz = nil super(expr, aliaz) @name = name diff --git a/test/nodes/test_count.rb b/test/nodes/test_count.rb index afa423e8f5..be53b86855 100644 --- a/test/nodes/test_count.rb +++ b/test/nodes/test_count.rb @@ -15,4 +15,13 @@ describe Arel::Nodes::Count do } end end + + describe "eq" do + it "should compare the count" do + table = Arel::Table.new :users + table[:id].count.eq(2).to_sql.must_be_like %{ + COUNT("users"."id") = 2 + } + end + end end |