diff options
-rw-r--r-- | lib/arel/nodes/node.rb | 1 | ||||
-rw-r--r-- | lib/arel/nodes/table_alias.rb | 2 | ||||
-rw-r--r-- | test/nodes/test_node.rb | 4 |
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/arel/nodes/node.rb b/lib/arel/nodes/node.rb index ff788e90d2..711fa34b6d 100644 --- a/lib/arel/nodes/node.rb +++ b/lib/arel/nodes/node.rb @@ -3,6 +3,7 @@ module Arel ### # Abstract base class for all AST nodes class Node + include Arel::FactoryMethods include Enumerable ### diff --git a/lib/arel/nodes/table_alias.rb b/lib/arel/nodes/table_alias.rb index 723b025883..4f4d5e29e9 100644 --- a/lib/arel/nodes/table_alias.rb +++ b/lib/arel/nodes/table_alias.rb @@ -6,7 +6,7 @@ module Arel alias :table_alias :name def [] name - Attribute.new self, name + Attribute.new(self, name) end end end diff --git a/test/nodes/test_node.rb b/test/nodes/test_node.rb index 71d2098a60..ffa3f273ea 100644 --- a/test/nodes/test_node.rb +++ b/test/nodes/test_node.rb @@ -2,6 +2,10 @@ require 'helper' module Arel class TestNode < MiniTest::Unit::TestCase + def test_includes_factory_methods + assert Node.new.respond_to?(:create_join) + end + def test_all_nodes_are_nodes Nodes.constants.map { |k| Nodes.const_get(k) |