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