modify to use redirect_back_or_default function

This commit is contained in:
kazubu 2015-10-26 14:58:09 +09:00
parent c3d48f9735
commit 0bfb9cbf38

View file

@ -124,11 +124,7 @@ class ProjectsController < ApplicationController
::Projects::DestroyService.new(@project, current_user, {}).execute
flash[:alert] = "Project '#{@project.name}' was deleted."
if request.referer.present? && request.referer.include?('/admin')
redirect_to admin_namespaces_projects_path
else
redirect_to dashboard_projects_path
end
redirect_back_or_default(default: dashboard_projects_path, options: {})
rescue Projects::DestroyService::DestroyError => ex
redirect_to edit_project_path(@project), alert: ex.message
end