app/controllers/admins/semesters_controller.rb
# Destroy is only allowed if the semester has no student applications or projects
# Otherwise, admin should reassign student applications and projects and then delete
Destroy is only allowed if the semester has no student applications or projects
Otherwise, admin should reassign student applications and projects and then delete
Destroy is only allowed if the semester has no student applications or projects Otherwise admin should reassign student applications and projects and then delete
def destroy
      @semester = Semester.find params[:id]
      if @semester.can_be_destroyed?
        @semester.destroy
        flash[:success] = t("admins.semesters.destroy.success")
      else
        flash[:error] = t("admins.semesters.destroy.error")
      end
      redirect_to admin_semesters_path
    end
def destroy @semester = Semester . find params [ :id ] if @semester . can_be_destroyed? @semester . destroy flash [ :success ] = t ( "admins.semesters.destroy.success" ) else flash [ :error ] = t ( "admins.semesters.destroy.error" ) end redirect_to admin_semesters_path end
Destroy is only allowed if the semester has no student applications or projects
Otherwise, admin should reassign student applications and projects and then delete
Destroy is only allowed if the semester has no student applications or projects Otherwise admin should reassign student applications and projects and then delete