From dc26a9cd39be4867dfc822cd4da019e478ff1a5f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 8 Oct 2006 10:42:50 +0000 Subject: association loading in documents/show git-svn-id: http://redmine.rubyforge.org/svn/trunk@24 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- redmine/app/controllers/documents_controller.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'redmine/app/controllers') diff --git a/redmine/app/controllers/documents_controller.rb b/redmine/app/controllers/documents_controller.rb index e8c8e2d03..f2693577e 100644 --- a/redmine/app/controllers/documents_controller.rb +++ b/redmine/app/controllers/documents_controller.rb @@ -16,10 +16,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class DocumentsController < ApplicationController - layout 'base' - before_filter :find_project, :authorize - - def show + layout 'base' + before_filter :find_project, :authorize + + def show + @attachments = @document.attachments.find(:all, :order => "created_on DESC") end def edit @@ -48,18 +49,17 @@ class DocumentsController < ApplicationController @attachment.author_id = self.logged_in_user.id if self.logged_in_user @attachment.save end - render :action => 'show' + redirect_to :action => 'show', :id => @document end def destroy_attachment @document.attachments.find(params[:attachment_id]).destroy - render :action => 'show' + redirect_to :action => 'show', :id => @document end private - def find_project + def find_project @document = Document.find(params[:id]) - @project = @document.project - end - + @project = @document.project + end end -- cgit v1.2.3