Reset timestamps and wiki page hierarchy on project copy.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2972 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-10-25 10:44:03 +00:00
parent 875eb47ad1
commit 4e73685af7
2 changed files with 5 additions and 5 deletions

View File

@ -78,7 +78,7 @@ class Issue < ActiveRecord::Base
def copy_from(arg) def copy_from(arg)
issue = arg.is_a?(Issue) ? arg : Issue.find(arg) issue = arg.is_a?(Issue) ? arg : Issue.find(arg)
self.attributes = issue.attributes.dup self.attributes = issue.attributes.dup.except("id", "created_on", "updated_on")
self.custom_values = issue.custom_values.collect {|v| v.clone} self.custom_values = issue.custom_values.collect {|v| v.clone}
self self
end end

View File

@ -455,8 +455,8 @@ class Project < ActiveRecord::Base
self.wiki ||= Wiki.new self.wiki ||= Wiki.new
wiki.attributes = project.wiki.attributes.dup.except("id", "project_id") wiki.attributes = project.wiki.attributes.dup.except("id", "project_id")
project.wiki.pages.each do |page| project.wiki.pages.each do |page|
new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id")) new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id", "updated_on"))
new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_id")) new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_id", "created_on", "parent_id"))
new_wiki_page.content = new_wiki_content new_wiki_page.content = new_wiki_content
wiki.pages << new_wiki_page wiki.pages << new_wiki_page
end end
@ -467,7 +467,7 @@ class Project < ActiveRecord::Base
def copy_versions(project) def copy_versions(project)
project.versions.each do |version| project.versions.each do |version|
new_version = Version.new new_version = Version.new
new_version.attributes = version.attributes.dup.except("id", "project_id") new_version.attributes = version.attributes.dup.except("id", "project_id", "created_on", "updated_on")
self.versions << new_version self.versions << new_version
end end
end end
@ -504,7 +504,7 @@ class Project < ActiveRecord::Base
def copy_members(project) def copy_members(project)
project.members.each do |member| project.members.each do |member|
new_member = Member.new new_member = Member.new
new_member.attributes = member.attributes.dup.except("id", "project_id") new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on")
new_member.role_ids = member.role_ids.dup new_member.role_ids = member.role_ids.dup
new_member.project = self new_member.project = self
self.members << new_member self.members << new_member