mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 04:56:22 +00:00
feat: reordenar usando los posts indexados
This commit is contained in:
parent
84419c05f8
commit
6946e86a02
1 changed files with 1 additions and 1 deletions
|
@ -74,7 +74,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
||||||
# { uuid => 2, uuid => 1, uuid => 0 }
|
# { uuid => 2, uuid => 1, uuid => 0 }
|
||||||
def reorder
|
def reorder
|
||||||
reorder = params.require(:post).permit(reorder: {})&.dig(:reorder)&.transform_values(&:to_i)
|
reorder = params.require(:post).permit(reorder: {})&.dig(:reorder)&.transform_values(&:to_i)
|
||||||
posts = site.posts(lang: locale).where(uuid: reorder.keys)
|
posts = site.indexed_posts(locale: locale).where(post_id: reorder.keys).map(&:post)
|
||||||
|
|
||||||
files = posts.map do |post|
|
files = posts.map do |post|
|
||||||
next unless post.attribute? :order
|
next unless post.attribute? :order
|
||||||
|
|
Loading…
Reference in a new issue