redirect to 404, when post was not found
This commit is contained in:
parent
700d42fe54
commit
45a2dd1635
3
page.rb
3
page.rb
|
@ -12,8 +12,7 @@ class Blog < Sinatra::Base
|
||||||
get '/post/:id' do
|
get '/post/:id' do
|
||||||
@post = Post.get_released(params[:id])
|
@post = Post.get_released(params[:id])
|
||||||
if @post.nil?
|
if @post.nil?
|
||||||
flash.warning = 'Post not found!'
|
404
|
||||||
redirect '/'
|
|
||||||
else
|
else
|
||||||
haml :post_single
|
haml :post_single
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user