Rails - Caches_Action expire_action
-
22-10-2019 - |
Pregunta
Quiero expirar una acción en caché y me pregunté cómo generar la referencia correcta.
#controller
caches_action :index, :layout => false
#generates this fragment which works fine
views/0.0.0.0:3000/article/someid/posts
#sweeper
...
expire_action article_posts_path(:article_id => post.article)
# results in this
Expired fragment: views//en/article/someid/posts (0.0ms)
Así que esto está casi bien, excepto que falta el anfitrión. ¿Qué hago que proporcione esto al método expire_action?
Gracias por adelantado.
Solución
Usar article_posts_url(:article_id => post.article)
resource_name_url
Las rutas generan URL con el conjunto de host.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow