]> source.dussan.org Git - redmine.git/commitdiff
"Cannot delete enumeration" error may occur when attempting to delete a project with...
authorGo MAEDA <maeda@farend.jp>
Sat, 25 Mar 2023 05:09:56 +0000 (05:09 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 25 Mar 2023 05:09:56 +0000 (05:09 +0000)
Patch by Holger Just and Mizuki ISHIKAWA.

git-svn-id: https://svn.redmine.org/redmine/trunk@22155 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb
test/unit/project_test.rb

index 43a55428e4a9c2845b2a4a033c3fb775cd41b432..a50fa8807aa60e8ee3c1af948fa099a5f1b23c0f 100644 (file)
@@ -30,8 +30,6 @@ class Project < ActiveRecord::Base
   # Maximum length for project identifiers
   IDENTIFIER_MAX_LENGTH = 100
 
-  # Specific overridden Activities
-  has_many :time_entry_activities, :dependent => :destroy
   has_many :memberships, :class_name => 'Member', :inverse_of => :project
   # Memberships of active users only
   has_many :members,
@@ -44,6 +42,8 @@ class Project < ActiveRecord::Base
   belongs_to :default_version, :class_name => 'Version'
   belongs_to :default_assigned_to, :class_name => 'Principal'
   has_many :time_entries, :dependent => :destroy
+  # Specific overridden Activities
+  has_many :time_entry_activities, :dependent => :destroy
   has_many :queries, :dependent => :destroy
   has_many :documents, :dependent => :destroy
   has_many :news, lambda {includes(:author)}, :dependent => :destroy
index 43a3bf59497c7977007c719bd62b91dc422105d2..4ee1e1b3610ace73cd4ac3752647ce34b99fa8c5 100644 (file)
@@ -236,6 +236,7 @@ class ProjectTest < ActiveSupport::TestCase
     # generate some dependent objects
     overridden_activity = TimeEntryActivity.new({:name => "Project", :project => @ecookbook})
     assert overridden_activity.save!
+    TimeEntry.generate!(:project => @ecookbook, :activity_id => overridden_activity.id)
 
     query = IssueQuery.generate!(:project => @ecookbook, :visibility => Query::VISIBILITY_ROLES, :roles => Role.where(:id => [1, 3]).to_a)