Refactor DossiersController#update

Nested ifs are heavier but easier to understand
as related conditions are visually grouped
This commit is contained in:
gregoirenovel 2018-09-06 13:31:29 +02:00
parent 230bf22b77
commit 6fe1f912c8

View file

@ -141,7 +141,8 @@ module NewUser
if errors.present?
flash.now.alert = errors
render :modifier
elsif current_user.owns?(dossier)
else
if current_user.owns?(dossier)
if Flipflop.new_dossier_details?
redirect_to demande_dossier_path(@dossier)
else
@ -151,6 +152,7 @@ module NewUser
redirect_to users_dossiers_invite_path(@dossier.invite_for_user(current_user))
end
end
end
def merci
@dossier = current_user.dossiers.includes(:procedure).find(params[:id])