Added ApplicationController#attach_files as a common method to attach files in all actions.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@990 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-12-14 17:33:05 +00:00
parent eb7cbd481e
commit 86319feef2
6 changed files with 27 additions and 54 deletions
+1 -5
View File
@@ -154,11 +154,7 @@ class WikiController < ApplicationController
def add_attachment
@page = @wiki.find_page(params[:page])
# Save the attachments
params[:attachments].each { |file|
next unless file.size > 0
a = Attachment.create(:container => @page, :file => file, :author => User.current)
} if params[:attachments] and params[:attachments].is_a? Array
attach_files(@page, params[:attachments])
redirect_to :action => 'index', :page => @page.title
end