diff options
-rw-r--r-- | app/controllers/documents_controller.rb | 4 | ||||
-rw-r--r-- | app/views/documents/_form.html.erb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 3f6c9497e..262088ed2 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -52,8 +52,8 @@ class DocumentsController < ApplicationController def create @document = @project.documents.build(params[:document]) - if request.post? and @document.save - attachments = Attachment.attach_files(@document, params[:attachments]) + @document.save_attachments(params[:attachments]) + if @document.save render_attachment_warning_if_needed(@document) flash[:notice] = l(:notice_successful_create) redirect_to :action => 'index', :project_id => @project diff --git a/app/views/documents/_form.html.erb b/app/views/documents/_form.html.erb index 600bf66eb..b5b5fa410 100644 --- a/app/views/documents/_form.html.erb +++ b/app/views/documents/_form.html.erb @@ -10,6 +10,6 @@ <% if @document.new_record? %> <div class="box tabular"> -<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p> +<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form', :locals => {:container => @document} %></p> </div> <% end %> |