aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-11-12 16:17:26 +0000
committerLouise Crow <louise.crow@gmail.com>2013-11-12 16:17:26 +0000
commit5cb6338e7153635d49801a6328f0a9a6b66aba43 (patch)
tree885f7935db70ad0fdd37482cd623892852c04f25
parent49ec8adf7027992377f8e322ef69db503e6eb94a (diff)
Use a block to automatically close file.
-rw-r--r--app/models/foi_attachment.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index 914420a2b..acbfc8a34 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -69,7 +69,7 @@ class FoiAttachment < ActiveRecord::Base
tries = 0
delay = 1
begin
- binary_data = File.open(self.filepath, "rb" ).read
+ binary_data = File.open(self.filepath, "rb" ){ |file| file.read }
if self.content_type =~ /^text/
@cached_body = convert_string_to_utf8_or_binary(binary_data, 'UTF-8')
else