Covering the case of an entry not being found. More diary entry tests.
This commit is contained in:
parent
ad9e48120a
commit
797cbaab1e
4 changed files with 57 additions and 9 deletions
|
@ -38,6 +38,8 @@ class DiaryEntryController < ApplicationController
|
|||
redirect_to :controller => 'diary_entry', :action => 'view', :id => params[:id]
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render :action => "no_such_entry", :status => :not_found
|
||||
end
|
||||
|
||||
def comment
|
||||
|
|
2
app/views/diary_entry/no_such_entry.rhtml
Normal file
2
app/views/diary_entry/no_such_entry.rhtml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h2>No entry with the id: <%= h(params[:id]) %></h2>
|
||||
<p>Sorry, there is no diary entry or comment with the id <%=h params[:id] -%>, or no id was given. Please check your spelling, or maybe the link you clicked is wrong.</p>
|
Loading…
Add table
Add a link
Reference in a new issue