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

Fixed deep copy bug in SelectManager clone

This commit is contained in:
Arthur Taylor 2011-04-15 22:34:18 +08:00 committed by Aaron Patterson
parent 3e3d4d1979
commit a318d6f5a7
2 changed files with 15 additions and 0 deletions

View file

@ -9,6 +9,11 @@ module Arel
from table
end
def initialize_copy other
super
@ctx = @ast.cores.last
end
def limit
@ast.limit && @ast.limit.expr
end

View file

@ -187,6 +187,16 @@ module Arel
m2.project "foo"
mgr.to_sql.wont_equal m2.to_sql
end
it 'makes updates to the correct copy' do
table = Table.new :users, :engine => Table.engine, :as => 'foo'
mgr = table.from table
m2 = mgr.clone
m3 = m2.clone
m2.project "foo"
mgr.to_sql.wont_equal m2.to_sql
m3.to_sql.must_equal mgr.to_sql
end
end
describe 'initialize' do