summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-10-25 10:44:03 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-10-25 10:44:03 +0000
commit4e73685af7fa45723ccc26c2692cac668835bda3 (patch)
tree09dddbba67d6f370049a4ab308a062052c638f04
parent875eb47ad1e4e845c1983242c4cf644beb3f922b (diff)
downloadredmine-4e73685af7fa45723ccc26c2692cac668835bda3.tar.gz
redmine-4e73685af7fa45723ccc26c2692cac668835bda3.zip
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
-rw-r--r--app/models/issue.rb2
-rw-r--r--app/models/project.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 7d2dd413c..f7b2f8a36 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -78,7 +78,7 @@ class Issue < ActiveRecord::Base
def copy_from(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
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 3fcedcae8..8b591a68c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -455,8 +455,8 @@ class Project < ActiveRecord::Base
self.wiki ||= Wiki.new
wiki.attributes = project.wiki.attributes.dup.except("id", "project_id")
project.wiki.pages.each do |page|
- new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id"))
- new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_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", "created_on", "parent_id"))
new_wiki_page.content = new_wiki_content
wiki.pages << new_wiki_page
end
@@ -467,7 +467,7 @@ class Project < ActiveRecord::Base
def copy_versions(project)
project.versions.each do |version|
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
end
end
@@ -504,7 +504,7 @@ class Project < ActiveRecord::Base
def copy_members(project)
project.members.each do |member|
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.project = self
self.members << new_member