This commit is contained in:
r888888888
2014-05-23 14:15:47 -04:00
committed by Toks
parent 4b7941cc95
commit 3049f8b57c
+1
View File
@@ -116,6 +116,7 @@ class PostsController < ApplicationController
def random def random
count = Post.fast_count(params[:tags]) count = Post.fast_count(params[:tags])
@post = Post.tag_match(params[:tags]).offset(rand(count)).first @post = Post.tag_match(params[:tags]).offset(rand(count)).first
raise ActiveRecord::RecordNotFound if @post.nil?
redirect_to post_path(@post, :tags => params[:tags]) redirect_to post_path(@post, :tags => params[:tags])
end end