diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 8daa4cf0b..b61db87e5 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -123,7 +123,7 @@ class Attachment < ActiveRecord::Base # Deletes the file from the file system if it's not referenced by other attachments def delete_from_disk - if Attachment.first(:conditions => ["disk_filename = ? AND id <> ?", disk_filename, id]).nil? + if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? delete_from_disk! end end