From 105b2a1f1c583d8ba449eb2765a66f3d5ce9e7c8 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 27 May 2024 15:13:40 -0300 Subject: [PATCH] fix: no fallar si el campo inverso es anidado --- app/services/post_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 4d32cba9..93daaa45 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -189,6 +189,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do def create_nested_posts!(post, params) post.nested_attributes.each do |nested_attribute| nested_metadata = post[nested_attribute] + next unless params[nested_metadata].present? # @todo find_or_initialize nested_post = nested_metadata.has_one || site.posts(lang: post.lang.value).build(layout: nested_metadata.nested) nested_params = params.require(nested_attribute).permit(nested_post.params).to_hash