summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-26 17:10:05 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-26 17:10:05 +0000
commit3bfaa20c057f97c25d4f8b68334bd4ff0f499887 (patch)
tree905f14a2a430418b40f1b658d99ad7ce6b0e3104 /app
parent58f8a23d58c5419a158d84888025a7ae930833ca (diff)
downloadredmine-3bfaa20c057f97c25d4f8b68334bd4ff0f499887.tar.gz
redmine-3bfaa20c057f97c25d4f8b68334bd4ff0f499887.zip
fixed: unable to attach a file when creating an issue ("attachment: invalid" error)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@122 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index e4a47d3d1..85c644d23 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -204,12 +204,14 @@ class ProjectsController < ApplicationController
@issue.attributes = params[:issue]
@issue.author_id = self.logged_in_user.id if self.logged_in_user
# Multiple file upload
+ @attachments = []
params[:attachments].each { |a|
- @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0
+ @attachments << Attachment.new(:container => @issue, :file => a, :author => logged_in_user) unless a.size == 0
} if params[:attachments] and params[:attachments].is_a? Array
@custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
- @issue.custom_values = @custom_values
+ @issue.custom_values = @custom_values
if @issue.save
+ @attachments.each(&:save)
flash[:notice] = l(:notice_successful_create)
Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
redirect_to :action => 'list_issues', :id => @project