From 0b353466a4c8113ed7c3fd57bed9f622ca298643 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 22 Mar 2023 18:43:20 -0300 Subject: [PATCH] fix: solo cambiar la licencia si existe una #159 --- app/services/site_service.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 87a08652..b4fa2fa0 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -119,18 +119,14 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do # Encuentra la licencia a partir de su enlace permanente y le cambia # el contenido - # - # TODO: Crear un layout específico para licencias así es más certera - # la búsqueda. def change_licencias site.locales.each do |locale| next unless I18n.available_locales.include? locale Mobility.with_locale(locale) do - permalink = "#{I18n.t('activerecord.models.licencia').downcase}/" - post = site.posts(lang: locale).find_by(permalink: permalink) + post = site.posts(lang: locale).find_by(layout: 'license') - post ? change_licencia(post: post) : add_licencia(lang: locale) + change_licencia(post: post) if post end end end