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 8, 2018
1 parent b12d08e commit eddc4c0
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 @@ -117,7 +117,8 @@ def purge_orphans(fk_name, window)
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}, polymorphic_type_column => klass.name)
.where(resource_table => {:id => nil})
.where("#{table_name}.#{connection.quote_column_name(polymorphic_type_column)} = #{connection.quote(klass.name)}")
total += purge_in_batches(scope, window)
end
total
Expand Down

0 comments on commit eddc4c0

Please sign in to comment.