Bu ekleri kaldırmak için kullanılabilecek ataç gelen yöntemler:
module Paperclip
class Attachment
# Clears out the attachment. Has the same effect as previously assigning
# nil to the attachment. Does NOT save. If you wish to clear AND save,
# use #destroy.
def clear
queue_existing_for_delete
@errors = {}
end
# Destroys the attachment. Has the same effect as previously assigning
# nil to the attachment *and saving*. This is permanent. If you wish to
# wipe out the existing attachment but not save, use #clear.
def destroy
clear
save
end
Demek hiç hata oluşursa yalnızca eki kaldırır yok, bkz. Bunu S3'e karşı kendi kurulumumla denedim, o yüzden yok etmeyi biliyorum.
Durumunuzdaki sorun, kaydetmeyi iptal eden herhangi bir doğrulama hakkınız olabilir mi? I.e validates_attachment_presence veya benzeri bir şey?
Öğrenmek için bir yolu @ user.logo.destroy denemek ve daha sonra herhangi bir hata iletisi olup olmadığını görmek için @ user.errors içeriğini kontrol etmek olduğunu düşünüyorum.
Burada listelediğiniz gibi yaptım, lütfen sorumu burada görebilirsiniz: http://stackoverflow.com/questions/14144454/how-to-hook-for-destroy-of-a-model-that-belongs- için-bir-model – simo