By default, I see that the carrier statement does not delete files associated with the model. How to do it?
Carrierwave should delete files from S3 automatically for you. I just checked this in a Rails 3.1 application.
You need to call
@image.destroy
not
@image.delete
Also use the refresh button on aws s3 panel
, , , after_destroy, , .
after_destroy
class Model < ActiveRecord::Base after_destroy :delete_linked_file def delete_linked_file # Delete the linked file here end end
, :
def delete_image_folder FileUtils.remove_dir(File.join(Rails.root, File.join( 'public' , file_name.store_dir)), :force => true) end
, Carrierwave, ( , )
Source: https://habr.com/ru/post/1785887/More articles:MSBuild Изменить значение конфигурации на основе сборки debug/release - msbuildLink Labels C # - display a list of them - c #how to create a password field and a button in vC ++ - passwordsadding dataTable plugin to dynamically created HTML table - javascriptStruts2 + tag + атрибут" headerValue" - struts2Calculating future value with an interesting combination with JavaScript - javascriptVery slow SQL update using a linked server - sqlAutorelease Pool Reset Application - objective-cAutomate write for loop in vim? - linuxShowing a custom UIView in an output leader (annotation) on a map using MapKit - iphoneAll Articles