From ce3ff1bdab28f0e0b19079c19c7374150f7d1bb1 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 17 Apr 2024 18:06:56 -0300 Subject: [PATCH] refactor: asignar atributos --- app/services/post_service.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index 4631a9a4..5770a717 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -10,13 +10,14 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do self.post = site.posts(lang: locale) .build(layout: layout) post.usuaries << usuarie - params[:post][:draft] = true if site.invitade? usuarie + post.draft.value = true if site.invitade? usuarie + post.assign_attributes(post_params) params.require(:post).permit(:slug).tap do |p| post.slug.value = p[:slug] if p[:slug].present? end - commit(action: :created, add: update_related_posts) if post.update(post_params) + commit(action: :created, add: update_related_posts) if post.save update_site_license!