mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
b543204613
commit
1de1041c00
2 changed files with 20 additions and 0 deletions
|
@ -12,6 +12,10 @@ module Arel
|
|||
def table_name
|
||||
relation.respond_to?(:name) ? relation.name : name
|
||||
end
|
||||
|
||||
def engine
|
||||
relation.engine
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
16
test/nodes/test_table_alias.rb
Normal file
16
test/nodes/test_table_alias.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue