I am trying to delete images in Cloudinary from my Rails application using the following code
def destroy
media = Media.find(params[:id])
Cloudinary::Uploader.destroy(media.image_id)
media.destroy
respond_to do |format|
format.html { redirect_to :action => 'index' }
format.xml { head :ok }
end
end
Aside from the Uploader.destroy method not actually deleting the image file from my media library^, what I need is to get any return code or error information from the operation. If the delete fails for any reason, I don't want to continue on and delete the media record from the database.
I've been looking through the Cloudinary gem and Googling, but haven't seen anything obvious. Can anyone show me what to do here?
^ I think it's not deleting because I am giving it the wrong image_id. Still working on that.