Sha256: bc64069f0a3985acb4cf6852ab4b78f972e28af36486190253fa62b26db9ac8c
Contents?: true
Size: 852 Bytes
Versions: 22
Compression:
Stored size: 852 Bytes
Contents
module ActiveRecord module ConnectionAdapters class SQLite3Adapter def join_to_update(update, select, key) if key.is_a?(::CompositePrimaryKeys::CompositeKeys) subselect = subquery_for(key, select) subselect_aliased = Arel::Nodes::TableAlias.new(subselect, 'cpk_inner') cpk_subselect = Arel::SelectManager.new(subselect_aliased) cpk_subselect.project('*') key.each do |a_key| where_expr = subselect_aliased[a_key.name].eq(update.ast.relation[a_key.name]) cpk_subselect.where(where_expr) end where_clause = Arel::Nodes::SqlLiteral.new("EXISTS (#{cpk_subselect.to_sql})") update.where(where_clause) else super end end alias join_to_delete join_to_update end end end
Version data entries
22 entries across 22 versions & 1 rubygems