From e9d33b625a8843f9fb9a20015b36045a4e7ba010 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 25 Apr 2023 14:51:54 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20encontrar=20el=20post=20a=20partir=20de?= =?UTF-8?q?=20su=20indexaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/indexed_post.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/indexed_post.rb b/app/models/indexed_post.rb index 7f6865f6..184cd05f 100644 --- a/app/models/indexed_post.rb +++ b/app/models/indexed_post.rb @@ -36,6 +36,15 @@ class IndexedPost < ApplicationRecord belongs_to :site + # Encuentra el post original + # + # @return [nil,Post] + def post + return if post_id.blank? + + @post ||= site.posts(lang: locale).find(post_id, uuid: true) + end + # Convertir locale a direccionario de PG # # @param [String,Symbol]