ruby on rails - deleting multiple files (versions) with Fog and Carrierwave - Rackspace -
i building application have file original, medium , thumbnail size images. using carrierwave accomplish this, , need remove versions of file rackspace cloud files:
class styleimageuploader < carrierwave::uploader::base version :medium process :resize_to_limit => [460, 460] end version :thumb process :resize_to_limit => [100, 100] end def filename "#{digest::md5.hexdigest(original_filename . time.now.to_s)}.#{file.extension}" if original_filename end end
however, when destroy through console, removing original version... how go deleting versions? error in console, still remove single file
#<fog::storage::rackspace::notfound: fog::storage::rackspace::notfound>
controller destroy method:
class imagescontroller < applicationcontroller def destroy @image = image.find(params[:id]) @image.destroy render :json => true end end
the problem in filename method... naming files differently, 1 second off time.now recalled. looks though filename method runs on each version method, timestamp off.
solution: https://github.com/jnicklas/carrierwave/wiki/how-to%3a-use-a-timestamp-in-file-names
Comments
Post a Comment