diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-26 01:03:35 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-26 01:03:35 +0000 |
commit | 673b5cc3939e9abc3bc1f5984f2a61ed45b70529 (patch) | |
tree | 5b02800891270972a8946518f37fb807f2b9b7d8 /app/models/raw_email.rb | |
parent | 0e546a79b205124d7b95b89e4a2e9cc520a4fc10 (diff) | |
parent | 6d7bea575ec185379efb648f6bbbd520029e3a91 (diff) |
Merge branch 'release/0.5' into develop
Diffstat (limited to 'app/models/raw_email.rb')
-rw-r--r-- | app/models/raw_email.rb | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb index 6e073aa27..3e12a6feb 100644 --- a/app/models/raw_email.rb +++ b/app/models/raw_email.rb @@ -27,7 +27,7 @@ class RawEmail < ActiveRecord::Base def directory request_id = self.incoming_message.info_request.id.to_s if ENV["RAILS_ENV"] == "test" - return 'files/raw_email_test' + return File.join(RAILS_ROOT, 'files/raw_email_test') else return File.join(MySociety::Config.get('RAW_EMAILS_LOCATION', 'files/raw_emails'), @@ -49,35 +49,13 @@ class RawEmail < ActiveRecord::Base end def data - if !File.exists?(self.filepath) - dbdata - else - File.open(self.filepath, "rb" ).read - end + File.open(self.filepath, "rb").read end def destroy_file_representation! File.delete(self.filepath) end - def dbdata=(d) - write_attribute(:data_binary, d) - end - - def dbdata - d = read_attribute(:data_binary) - if !d.nil? - return d - end - - d = read_attribute(:data_text) - if !d.nil? - return d - end - - raise "internal error, double nil value in RawEmail" - end - end |