Skip to content

Commit

Permalink
Appease brakeman with many wheres
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonin committed Jan 5, 2018
1 parent b21431b commit ef35a34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/mixins/purging_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def purge_polymorphic_orphans(fk_name, window)
polymorphic_classes(type_column).each do |klass|
resource_table = connection.quote_table_name(klass.table_name)
scope = joins("LEFT OUTER JOIN #{resource_table} ON #{table_name}.resource_id = #{resource_table}.id")
.where(resource_table => {:id => nil}, type_column => klass.name)
.where(resource_table => {:id => nil})
.where("#{table_name}.#{connection.quote_column_name(type_column)} = #{connection.quote(klass.name)}")
total += purge_in_batches(scope, window)
end
total
Expand Down

0 comments on commit ef35a34

Please sign in to comment.