mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 05:26:22 +00:00
fix: no fallar si el campo inverso es anidado
This commit is contained in:
parent
e2514a7f10
commit
105b2a1f1c
1 changed files with 1 additions and 0 deletions
|
@ -189,6 +189,7 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
||||||
def create_nested_posts!(post, params)
|
def create_nested_posts!(post, params)
|
||||||
post.nested_attributes.each do |nested_attribute|
|
post.nested_attributes.each do |nested_attribute|
|
||||||
nested_metadata = post[nested_attribute]
|
nested_metadata = post[nested_attribute]
|
||||||
|
next unless params[nested_metadata].present?
|
||||||
# @todo find_or_initialize
|
# @todo find_or_initialize
|
||||||
nested_post = nested_metadata.has_one || site.posts(lang: post.lang.value).build(layout: nested_metadata.nested)
|
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
|
nested_params = params.require(nested_attribute).permit(nested_post.params).to_hash
|
||||||
|
|
Loading…
Reference in a new issue