posts: fix exception in random:1 filetype:png.

This commit is contained in:
evazion
2022-11-15 19:33:25 -06:00
parent e935f01358
commit bc169fc98c
2 changed files with 4 additions and 3 deletions

View File

@@ -966,11 +966,11 @@ class Post < ApplicationRecord
end
def random_up(key)
where("md5 < ?", key).reorder(md5: :desc).first
where("posts.md5 < ?", key).reorder(md5: :desc).first
end
def random_down(key)
where("md5 >= ?", key).reorder(md5: :asc).first
where("posts.md5 >= ?", key).reorder(md5: :asc).first
end
def sample(query, sample_size)