Permalink
Browse files

Add Nodes::TableAlias#engine

Eventually #engine should go away, but until that time, this means that
Table and Nodes::TableAlias can be used more interchangeably.
  • Loading branch information...
1 parent b543204 commit 1de1041c00abff9cfc57837a80e12157901ff194 @jonleighton jonleighton committed Jul 13, 2012
Showing with 20 additions and 0 deletions.
  1. +4 −0 lib/arel/nodes/table_alias.rb
  2. +16 −0 test/nodes/test_table_alias.rb
@@ -12,6 +12,10 @@ def [] name
def table_name
relation.respond_to?(:name) ? relation.name : name
end
+
+ def engine
+ relation.engine
+ end
end
end
end
@@ -0,0 +1,16 @@
+require 'helper'
+require 'ostruct'
+
+module Arel
+ module Nodes
+ describe 'table alias' do
+ it 'has an #engine which delegates to the relation' do
+ engine = Object.new
+ relation = OpenStruct.new(:engine => engine)
+
+ node = TableAlias.new relation, :foo
+ node.engine.must_equal engine
+ end
+ end
+ end
+end

0 comments on commit 1de1041

Please sign in to comment.