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