diff options
author | Robin Houston <robin@lenny.robin> | 2011-06-21 02:27:28 +0100 |
---|---|---|
committer | Robin Houston <robin@lenny.robin> | 2011-06-21 02:27:28 +0100 |
commit | 23a8c8fae9eb3e0892cdab5c6f3343bf06a5c6dc (patch) | |
tree | 012d5e686a3b6020487d384f38458ae6f9c5b111 /app/models/request_mailer.rb | |
parent | 9d62991558aba1f0603a3107a8b2ca19010dbf56 (diff) |
- Refactor models/incoming_message.rb to get rid of the hideous
global variables and methods. Move the MIME type stuff into
lib/alaveteli_file_types.rb.
- Correct the spelling of the word extensions (not extentions).
Diffstat (limited to 'app/models/request_mailer.rb')
-rw-r--r-- | app/models/request_mailer.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 910f38cbe..72c382194 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -6,6 +6,8 @@ # # $Id: request_mailer.rb,v 1.89 2009-10-04 21:53:54 francis Exp $ +require 'alaveteli_file_types' + class RequestMailer < ApplicationMailer # Used when an FOI officer uploads a response from their web browser - this is @@ -18,13 +20,7 @@ class RequestMailer < ApplicationMailer :body => body } if !attachment_name.nil? && !attachment_content.nil? - IncomingMessage # load global filename_to_mimetype XXX should move filename_to_mimetype to proper namespace - calc_mime = filename_to_mimetype(attachment_name) - if calc_mime - content_type = calc_mime - else - content_type = 'application/octet-stream' - end + content_type = AlaveteliFileTypes.filename_to_mimetype(attachment_name) || 'application/octet-stream' attachment :content_type => content_type, :body => attachment_content, |