Platform cloning (untested)
This commit is contained in:
parent
06d229a4b0
commit
9a91224d91
|
@ -11,6 +11,16 @@ class Platform < ActiveRecord::Base
|
|||
build_path(unixname)
|
||||
end
|
||||
|
||||
def clone(new_name, new_unixname)
|
||||
p = Platform.new
|
||||
p.name = new_name
|
||||
p.unixname = new_unixname
|
||||
p.parent = self
|
||||
p.repositories = repositories.map(&:clone)
|
||||
p.save!
|
||||
return p
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def build_path(dir)
|
||||
|
|
|
@ -17,6 +17,13 @@ class Project < ActiveRecord::Base
|
|||
build_path(unixname)
|
||||
end
|
||||
|
||||
def clone
|
||||
p = Project.new
|
||||
p.name = name
|
||||
p.unixname = unixname
|
||||
return p
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def build_path(dir)
|
||||
|
|
|
@ -11,6 +11,14 @@ class Repository < ActiveRecord::Base
|
|||
build_path(unixname)
|
||||
end
|
||||
|
||||
def clone
|
||||
r = Repository.new
|
||||
r.name = name
|
||||
r.unixname = unixname
|
||||
r.projects = projects.map(&:clone)
|
||||
return r
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def build_path(dir)
|
||||
|
|
Loading…
Reference in New Issue