summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-06-19 03:54:17 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-06-19 03:54:17 +0000
commitc56c0f411c577fe17b64fe33875cad5d75e34284 (patch)
tree69c1c52d5e8b8f70da2b7656333c7cb7bac6a564 /app/models
parent759858d11d0c819d188efc4540960513dd3027dc (diff)
downloadredmine-c56c0f411c577fe17b64fe33875cad5d75e34284.tar.gz
redmine-c56c0f411c577fe17b64fe33875cad5d75e34284.zip
Fix a nil error when a Project cannot save attachments.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3772 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/attachment.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index c752e0e52..f05b35c77 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -150,7 +150,13 @@ class Attachment < ActiveRecord::Base
:file => file,
:description => attachment['description'].to_s.strip,
:author => User.current)
- a.new_record? ? (obj.unsaved_attachments << a) : (attached << a)
+
+ if a.new_record?
+ obj.unsaved_attachments ||= []
+ obj.unsaved_attachments << a
+ else
+ attached << a
+ end
end
end
{:files => attached, :unsaved => obj.unsaved_attachments}