ActiveRecord::RecordNotFound exceptions handled more gracefully

git-svn-id: http://redmine.rubyforge.org/svn/trunk@133 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-01-02 08:47:07 +00:00
parent e7caec6e7d
commit e3becc7c3c
13 changed files with 48 additions and 21 deletions
+3 -2
View File
@@ -132,8 +132,7 @@ class IssuesController < ApplicationController
@attachment = @issue.attachments.find(params[:attachment_id])
send_file @attachment.diskfile, :filename => @attachment.filename
rescue
flash.now[:notice] = l(:notice_file_not_found)
render :text => "", :layout => true, :status => 404
render_404
end
private
@@ -141,5 +140,7 @@ private
@issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])
@project = @issue.project
@html_title = "#{@project.name} - #{@issue.tracker.name} ##{@issue.id}"
rescue ActiveRecord::RecordNotFound
render_404
end
end