diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 125e87cff..2ca68f4f6 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -70,12 +70,10 @@ class EnumerationsController < ApplicationController @enumeration.destroy redirect_to enumerations_path return - elsif params[:reassign_to_id] - if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id]) - @enumeration.destroy(reassign_to) - redirect_to enumerations_path - return - end + elsif params[:reassign_to_id].present? && (reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id].to_i)) + @enumeration.destroy(reassign_to) + redirect_to enumerations_path + return end @enumerations = @enumeration.class.system.all - [@enumeration] end diff --git a/app/views/enumerations/destroy.html.erb b/app/views/enumerations/destroy.html.erb index 3b47b40b2..b469d4f9b 100644 --- a/app/views/enumerations/destroy.html.erb +++ b/app/views/enumerations/destroy.html.erb @@ -4,7 +4,7 @@
<%= l(:text_enumeration_destroy_question, @enumeration.objects_count) %>
-<%= select_tag 'reassign_to_id', (content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") + options_from_collection_for_select(@enumerations, 'id', 'name')) %>
+<%= select_tag 'reassign_to_id', (content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '') + options_from_collection_for_select(@enumerations, 'id', 'name')) %>