/posts/random: fix reorder(nil).first deprecation warning
DEPRECATION WARNING: `.reorder(nil)` with `.first` / `.first!` no
longer takes non-deterministic result in Rails 6.2. To continue
taking non-deterministic result, use `.take` / `.take!` instead.
(called from random at /home/user/src/danbooru/app/controllers/posts_controller.rb:91)
This commit is contained in:
@@ -88,7 +88,7 @@ class PostsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def random
|
def random
|
||||||
@post = Post.user_tag_match(params[:tags]).random(1).first
|
@post = Post.user_tag_match(params[:tags]).random(1).take
|
||||||
raise ActiveRecord::RecordNotFound if @post.nil?
|
raise ActiveRecord::RecordNotFound if @post.nil?
|
||||||
authorize @post
|
authorize @post
|
||||||
respond_with(@post) do |format|
|
respond_with(@post) do |format|
|
||||||
|
|||||||
Reference in New Issue
Block a user