summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-06 06:39:15 -0500
committerPeter Kozak <spag@golwen.net>2013-03-06 06:39:15 -0500
commit287e9d8fe964b0b0449732597f1f5ef5057cf4b3 (patch)
treec815b13eddcbcd55ced3425298eec48773223cd9 /app
parenta710d0d8033c84b72e1a6395adfbd6beebf80730 (diff)
Abort on conversion errors
Diffstat (limited to 'app')
-rw-r--r--app/controllers/fax_documents_controller.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/fax_documents_controller.rb b/app/controllers/fax_documents_controller.rb
index c2b3083..43852c6 100644
--- a/app/controllers/fax_documents_controller.rb
+++ b/app/controllers/fax_documents_controller.rb
@@ -61,8 +61,14 @@ class FaxDocumentsController < ApplicationController
@fax_document = @fax_account.fax_documents.build(params[:fax_document])
@fax_document.retry_counter = @fax_account.retries
if @fax_document.save
- @fax_document.queue_for_sending!
- redirect_to fax_account_fax_document_path(@fax_document.fax_account, @fax_document), :notice => t('fax_documents.controller.successfuly_created')
+ if @fax_document.tiff.blank?
+ @fax_document.destroy
+ @fax_document.errors.add(:document, t('fax_documents.controller.tiff_not_created'))
+ render :new
+ else
+ @fax_document.queue_for_sending!
+ redirect_to fax_account_fax_document_path(@fax_document.fax_account, @fax_document), :notice => t('fax_documents.controller.successfuly_created')
+ end
else
render :new
end