Confirm with flash after avis is sent
This commit is contained in:
parent
f9aee06040
commit
612a8c4b91
1 changed files with 5 additions and 2 deletions
|
@ -8,13 +8,16 @@ class Backoffice::AvisController < ApplicationController
|
|||
avis = Avis.new(create_params)
|
||||
avis.dossier = dossier
|
||||
|
||||
gestionnaire = Gestionnaire.find_by(email: create_params[:email])
|
||||
email = create_params[:email]
|
||||
gestionnaire = Gestionnaire.find_by(email: email)
|
||||
if gestionnaire
|
||||
avis.gestionnaire = gestionnaire
|
||||
avis.email = nil
|
||||
end
|
||||
|
||||
avis.save
|
||||
if avis.save
|
||||
flash[:notice] = "Votre demande d'avis a bien été envoyée à #{email}"
|
||||
end
|
||||
|
||||
redirect_to backoffice_dossier_path(dossier)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue