FIX: OptimizedImage model doesn't have 'created_at' date column

FIX: OptimizedImage model doesn’t have ‘created_at’ date column

diff --git a/lib/s3_inventory.rb b/lib/s3_inventory.rb
index 5b26717..19afad5 100644
--- a/lib/s3_inventory.rb
+++ b/lib/s3_inventory.rb
@@ -46,7 +46,7 @@ class S3Inventory
           end
         end
 
-        uploads = model.where("created_at < ?", last_modified)
+        uploads = (model == Upload) ? model.where("created_at < ?", last_modified) : model
         missing_uploads = uploads.joins("LEFT JOIN #{table_name} ON #{table_name}.etag = #{model.table_name}.etag").where("#{table_name}.etag is NULL")
 
         if (missing_count = missing_uploads.count) > 0

GitHub sha: b8d25499