From a79e095293f30a3c82b2f1d38569afda045d9064 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 29 May 2015 15:10:53 +0000 Subject: [PATCH] Add a guard against accidental moves --- app/controllers/receipt_item_types_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/receipt_item_types_controller.rb b/app/controllers/receipt_item_types_controller.rb index ef29ebe..a176f43 100644 --- a/app/controllers/receipt_item_types_controller.rb +++ b/app/controllers/receipt_item_types_controller.rb @@ -107,7 +107,7 @@ def get_autocomplete_items(parameters) def move_to old_type = current_account.receipt_item_types.find(params[:id]) new_type = current_account.receipt_item_types.find(params[:new_id]) - if old_type && new_type + if old_type && new_type && old_type.id != new_type.id old_type.move_to(new_type) respond_with(new_type) else