Permalink
Browse files

Use new SelectManager#projections= method

  • Loading branch information...
1 parent 12aaad0 commit cc206a3507699e2c94b2d62ec5226fd20d5d98b3 @jonleighton jonleighton committed Aug 11, 2011
@@ -310,8 +310,8 @@ def sanitize_limit(limit)
# on mysql (even when aliasing the tables), but mysql allows using JOIN directly in
# an UPDATE statement, so in the mysql adapters we redefine this to do that.
def join_to_update(update, select) #:nodoc:
- subselect = select.ast.clone
- subselect.cores.last.projections = [update.key]
+ subselect = select.clone
+ subselect.projections = [update.key]
update.where update.key.in(subselect)
end
@@ -585,7 +585,7 @@ def limited_update_conditions(where_sql, quoted_table_name, quoted_primary_key)
def join_to_update(update, select) #:nodoc:
if select.limit || select.offset || select.orders.any?
subsubselect = select.clone
- subsubselect.ast.cores.last.projections = [update.key]
+ subsubselect.projections = [update.key]
subselect = Arel::SelectManager.new(select.engine)
subselect.project Arel.sql(update.key.name)
@@ -499,7 +499,7 @@ def release_savepoint
def join_to_update(update, select) #:nodoc:
if select.limit || select.offset || select.orders.any?
subsubselect = select.clone
- subsubselect.ast.cores.last.projections = [update.key]
+ subsubselect.projections = [update.key]
subselect = Arel::SelectManager.new(select.engine)
subselect.project Arel.sql(update.key.name)

0 comments on commit cc206a3

Please sign in to comment.