Skip to content

Commit

Permalink
Merge pull request #18628 from jrafanie/use_public_sanitize_sql_to_fi…
Browse files Browse the repository at this point in the history
…x_deprecation

Use sanitize_sql to fix deprecation on _conditions
  • Loading branch information
carbonin authored Apr 5, 2019
2 parents 351d032 + bd4ba97 commit 4d32379
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/miq_region.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def self.destroy_region(conn, region, tables = nil)
tables.each do |t|
pk = conn.primary_key(t)
if pk
conditions = sanitize_conditions(region_to_conditions(region, pk))
conditions = sanitize_sql(region_to_conditions(region, pk))
else
id_cols = connection.columns(t).select { |c| c.name.ends_with?("_id") }
next if id_cols.empty?
conditions = id_cols.collect { |c| "(#{sanitize_conditions(region_to_conditions(region, c.name))})" }.join(" OR ")
conditions = id_cols.collect { |c| "(#{sanitize_sql(region_to_conditions(region, c.name))})" }.join(" OR ")
end

rows = conn.delete("DELETE FROM #{t} WHERE #{conditions}")
Expand Down

0 comments on commit 4d32379

Please sign in to comment.