Permalink
Browse files

Use new SelectManager#projections= method

  • Loading branch information...
jonleighton committed Aug 11, 2011
1 parent eff8aee commit c701b3f7496362994a0b07d991aee0c2021cc9b0
@@ -337,8 +337,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
@@ -607,7 +607,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)
@@ -513,7 +513,7 @@ def add_limit_offset!(sql, options) #:nodoc:
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 c701b3f

Please sign in to comment.