Forums: attachments can now be added to replies.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@923 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-11-22 19:19:47 +00:00
parent 0634591b3d
commit 7704e2d919
3 changed files with 18 additions and 10 deletions
+6 -2
View File
@@ -35,8 +35,7 @@ class MessagesController < ApplicationController
@message.board = @board
if request.post? && @message.save
params[:attachments].each { |file|
next unless file.size > 0
Attachment.create(:container => @message, :file => file, :author => User.current)
Attachment.create(:container => @message, :file => file, :author => User.current) if file.size > 0
} if params[:attachments] and params[:attachments].is_a? Array
redirect_to :action => 'show', :id => @message
end
@@ -47,6 +46,11 @@ class MessagesController < ApplicationController
@reply.author = User.current
@reply.board = @board
@message.children << @reply
if !@reply.new_record?
params[:attachments].each { |file|
Attachment.create(:container => @reply, :file => file, :author => User.current) if file.size > 0
} if params[:attachments] and params[:attachments].is_a? Array
end
redirect_to :action => 'show', :id => @message
end