Mercurial > hg > soundsoftware-site
comparison app/controllers/documents_controller.rb @ 929:5f33065ddc4b redmine-1.3
Update to Redmine SVN rev 9414 on 1.3-stable branch
author | Chris Cannam |
---|---|
date | Wed, 27 Jun 2012 14:54:18 +0100 |
parents | cbb26bc654de |
children | 433d4f72a19b |
comparison
equal
deleted
inserted
replaced
909:cbb26bc654de | 929:5f33065ddc4b |
---|---|
45 def show | 45 def show |
46 @attachments = @document.attachments.find(:all, :order => "created_on DESC") | 46 @attachments = @document.attachments.find(:all, :order => "created_on DESC") |
47 end | 47 end |
48 | 48 |
49 def new | 49 def new |
50 @document = @project.documents.build(params[:document]) | 50 @document = @project.documents.build |
51 @document.safe_attributes = params[:document] | |
51 if request.post? and @document.save | 52 if request.post? and @document.save |
52 attachments = Attachment.attach_files(@document, params[:attachments]) | 53 attachments = Attachment.attach_files(@document, params[:attachments]) |
53 render_attachment_warning_if_needed(@document) | 54 render_attachment_warning_if_needed(@document) |
54 flash[:notice] = l(:notice_successful_create) | 55 flash[:notice] = l(:notice_successful_create) |
55 redirect_to :action => 'index', :project_id => @project | 56 redirect_to :action => 'index', :project_id => @project |
56 end | 57 end |
57 end | 58 end |
58 | 59 |
59 def edit | 60 def edit |
60 @categories = DocumentCategory.active #TODO: use it in the views | 61 @categories = DocumentCategory.active #TODO: use it in the views |
61 if request.post? and @document.update_attributes(params[:document]) | 62 @document.safe_attributes = params[:document] |
63 if request.post? and @document.save | |
62 flash[:notice] = l(:notice_successful_update) | 64 flash[:notice] = l(:notice_successful_update) |
63 redirect_to :action => 'show', :id => @document | 65 redirect_to :action => 'show', :id => @document |
64 end | 66 end |
65 end | 67 end |
66 | 68 |