mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 00:06:21 +00:00
refactor: asignar atributos
This commit is contained in:
parent
42e9d5fd66
commit
ce3ff1bdab
1 changed files with 3 additions and 2 deletions
|
@ -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!
|
||||
|
||||
|
|
Loading…
Reference in a new issue