From 50cb77cfbb09750dad7809f46914b8f81dc0c13a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Mar 2011 11:46:01 +0000 Subject: Fixed: children projects are deleted instead of being destroyed when destroying parent project (#7904). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5171 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/project.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'app/models') diff --git a/app/models/project.rb b/app/models/project.rb index b20a218ba..0de3f0e9c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -56,7 +56,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' + acts_as_nested_set :order => 'name', :dependent => :destroy acts_as_attachable :view_permission => :view_files, :delete_permission => :manage_files @@ -79,7 +79,7 @@ class Project < ActiveRecord::Base # reserved words validates_exclusion_of :identifier, :in => %w( new ) - before_destroy :delete_all_members, :destroy_children + before_destroy :delete_all_members 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}"} @@ -627,13 +627,6 @@ 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 -- cgit v1.2.3