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!