discord: add /random command.

This commit is contained in:
evazion
2021-03-11 21:23:20 -06:00
parent b79bd8407f
commit 698be2d0e4
8 changed files with 146 additions and 88 deletions

View File

@@ -88,7 +88,7 @@ class PostsController < ApplicationController
end
def random
@post = Post.user_tag_match(params[:tags]).random
@post = Post.user_tag_match(params[:tags]).random(1).first
raise ActiveRecord::RecordNotFound if @post.nil?
authorize @post
respond_with(@post) do |format|