diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index bb9bbd01d..5fa965fd1 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -116,6 +116,7 @@ class PostsController < ApplicationController def random count = Post.fast_count(params[:tags]) @post = Post.tag_match(params[:tags]).offset(rand(count)).first + raise ActiveRecord::RecordNotFound if @post.nil? redirect_to post_path(@post, :tags => params[:tags]) end