title: Catching Errors From Cloudinary In Rails
body: <p>I am trying to delete images in Cloudinary from my Rails application using the following code</p>
  
  <pre><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 =&gt; 'index' }
          format.xml { head :ok }
      end
  end
  </code></pre>
  
  <p>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.</p>
  
  <p>I've been looking through the Cloudinary gem and Googling, but haven't seen anything obvious. Can anyone show me what to do here?</p>
  
  <p>^ <em>I think it's not deleting because I am giving it the wrong image_id. Still working on that.</em> </p>