diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-06-03 11:15:09 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-06-03 11:15:09 +0100 |
commit | cfd737427102f3e8449e6ed46ce768b3c520d387 (patch) | |
tree | e6d4a43127babce5a1ffce4d62de9f24bd54f300 | |
parent | d08b12b5e572a5c79be0a5bcbbd420e779a32a0f (diff) |
Clean IncomingMessage#_uudecode_and_save_attachments
each instead of for
remove self
avoid explicit return
-rw-r--r-- | app/models/incoming_message.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 4feee7637..546964c95 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -505,7 +505,7 @@ class IncomingMessage < ActiveRecord::Base # Find any uudecoded things buried in it, yeuchly uus = text.scan(/^begin.+^`\n^end\n/m) attachments = [] - for uu in uus + uus.each do |uu| # Decode the string content = nil tempfile = Tempfile.new('foiuu') @@ -523,7 +523,7 @@ class IncomingMessage < ActiveRecord::Base content_type = 'application/octet-stream' end hexdigest = Digest::MD5.hexdigest(content) - attachment = self.foi_attachments.find_or_create_by_hexdigest(hexdigest) + attachment = foi_attachments.find_or_create_by_hexdigest(hexdigest) attachment.update_attributes(:filename => filename, :content_type => content_type, :body => content, @@ -531,7 +531,7 @@ class IncomingMessage < ActiveRecord::Base attachment.save! attachments << attachment end - return attachments + attachments end def get_attachments_for_display |