bug fixing using cursor
This commit is contained in:
		| @@ -49,8 +49,15 @@ class ClientsController < ApplicationController | ||||
|  | ||||
|   # DELETE /clients/1 or /clients/1.json | ||||
|   def destroy | ||||
|     @client.destroy! | ||||
|     if @client.referenced_count > 0 | ||||
|       respond_to do |format| | ||||
|         format.html { redirect_to clients_path, alert: "Client is referenced by subprojects and cannot be deleted." } | ||||
|         format.json { render json: { error: "Client has references" }, status: :unprocessable_entity } | ||||
|       end | ||||
|       return | ||||
|     end | ||||
|  | ||||
|     @client.destroy! | ||||
|     respond_to do |format| | ||||
|       format.html { redirect_to clients_path, status: :see_other, notice: "Client was successfully destroyed." } | ||||
|       format.json { head :no_content } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Stefan Tollkühn
					Stefan Tollkühn