Fixed: error while deleting an in-use enumeration (#4970).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3524 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0fd7e2d696
commit
b09a483aa9
|
@ -76,12 +76,12 @@ class EnumerationsController < ApplicationController
|
||||||
@enumeration.destroy
|
@enumeration.destroy
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
elsif params[:reassign_to_id]
|
elsif params[:reassign_to_id]
|
||||||
if reassign_to = Enumeration.find_by_type_and_id(@enumeration.type, params[:reassign_to_id])
|
if reassign_to = @enumeration.class.find_by_id(params[:reassign_to_id])
|
||||||
@enumeration.destroy(reassign_to)
|
@enumeration.destroy(reassign_to)
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@enumerations = Enumeration.find(:all, :conditions => ['type = (?)', @enumeration.type]) - [@enumeration]
|
@enumerations = @enumeration.class.find(:all) - [@enumeration]
|
||||||
#rescue
|
#rescue
|
||||||
# flash[:error] = 'Unable to delete enumeration'
|
# flash[:error] = 'Unable to delete enumeration'
|
||||||
# redirect_to :action => 'index'
|
# redirect_to :action => 'index'
|
||||||
|
|
Loading…
Reference in New Issue