mirror of
https://github.com/redmine/redmine.git
synced 2025-11-17 18:50:53 +01:00
Fixed: deleting a project with subprojects breaks the project tree (#4701).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3354 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -51,7 +51,7 @@ class Project < ActiveRecord::Base
|
||||
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
|
||||
:association_foreign_key => 'custom_field_id'
|
||||
|
||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||
acts_as_nested_set :order => 'name'
|
||||
acts_as_attachable :view_permission => :view_files,
|
||||
:delete_permission => :manage_files
|
||||
|
||||
@@ -74,7 +74,7 @@ class Project < ActiveRecord::Base
|
||||
# reserved words
|
||||
validates_exclusion_of :identifier, :in => %w( new )
|
||||
|
||||
before_destroy :delete_all_members
|
||||
before_destroy :delete_all_members, :destroy_children
|
||||
|
||||
named_scope :has_module, lambda { |mod| { :conditions => ["#{Project.table_name}.id IN (SELECT em.project_id FROM #{EnabledModule.table_name} em WHERE em.name=?)", mod.to_s] } }
|
||||
named_scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"}
|
||||
@@ -499,6 +499,13 @@ class Project < ActiveRecord::Base
|
||||
|
||||
private
|
||||
|
||||
# Destroys children before destroying self
|
||||
def destroy_children
|
||||
children.each do |child|
|
||||
child.destroy
|
||||
end
|
||||
end
|
||||
|
||||
# Copies wiki from +project+
|
||||
def copy_wiki(project)
|
||||
# Check that the source project has a wiki first
|
||||
|
||||
Reference in New Issue
Block a user