5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 19:26:21 +00:00

refactor: asignar atributos

This commit is contained in:
f 2024-04-17 18:06:56 -03:00
parent 42e9d5fd66
commit ce3ff1bdab
No known key found for this signature in database

View file

@ -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!