mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 15:51:41 +00:00
fix: poder pasar el slug como parametro
como slug es un atributo privado, hay que asignarlo manualmente
This commit is contained in:
parent
136a9e3edb
commit
caa4861d79
1 changed files with 4 additions and 0 deletions
|
@ -12,6 +12,10 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
|
|||
post.usuaries << usuarie
|
||||
params[:post][:draft] = true if site.invitade? usuarie
|
||||
|
||||
params.require(:post).permit(:slug).tap do |p|
|
||||
post.slug.value = p[:slug] if p[:slug].present?
|
||||
end
|
||||
|
||||
commit(action: :created, file: update_related_posts) if post.update(post_params)
|
||||
|
||||
# Devolver el post aunque no se haya salvado para poder rescatar los
|
||||
|
|
Loading…
Reference in a new issue