1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Table.new can take a hash for the second param

This commit is contained in:
Aaron Patterson 2010-08-13 11:53:36 -07:00
parent bfe0348889
commit 5d7cad6079
2 changed files with 16 additions and 3 deletions

View file

@ -6,9 +6,10 @@ module Arel
attr_reader :name, :engine
def initialize name, engine = Table.engine
@name = name
@engine = engine
@columns = nil
@name = name
@engine = engine
@engine = engine[:engine] if Hash === engine
@columns = nil
end
def tm

View file

@ -6,6 +6,18 @@ module Arel
@relation = Table.new(:users)
end
describe 'new' do
it 'should accept an engine' do
rel = Table.new :users, 'foo'
rel.engine.should == 'foo'
end
it 'should accept a hash' do
rel = Table.new :users, :engine => 'foo'
rel.engine.should == 'foo'
end
end
describe 'where' do
it "returns a tree manager" do
manager = @relation.where @relation[:id].eq 1