summaryrefslogtreecommitdiffstats
path: root/app/controllers/messages_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-22 19:19:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-22 19:19:47 +0000
commit7704e2d9191d00d19115198f981e2262bc11dc25 (patch)
tree5676d3aa9abdf93faad31cce5e0f3c668f0003b0 /app/controllers/messages_controller.rb
parent0634591b3db01098057f2e20e101d7886ddbff5a (diff)
downloadredmine-7704e2d9191d00d19115198f981e2262bc11dc25.tar.gz
redmine-7704e2d9191d00d19115198f981e2262bc11dc25.zip
Forums: attachments can now be added to replies.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@923 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/messages_controller.rb')
-rw-r--r--app/controllers/messages_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 645aadf1c..9352c4af4 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -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