Merge pull request #517 from warpc/207-platform_clone
[refs #207] Fix platform clone. Always set released to false for target platform.
This commit is contained in:
commit
6435817163
|
@ -104,11 +104,10 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def base_clone(attrs = {}) # :description, :name, :owner
|
||||
clone.tap do |c|
|
||||
# c.attributes = attrs #
|
||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
c.parent = self
|
||||
dup.tap do |c|
|
||||
attrs.each {|k,v| c.send("#{k}=", v)} # c.attributes = attrs
|
||||
c.updated_at = nil; c.created_at = nil
|
||||
c.parent = self; c.released = false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -54,10 +54,10 @@ class Product < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def full_clone(attrs = {})
|
||||
clone.tap do |c| # dup
|
||||
dup.tap do |c|
|
||||
c.platform_id = nil
|
||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
c.updated_at = nil; c.created_at = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ class Repository < ActiveRecord::Base
|
|||
attr_readonly :name, :platform_id
|
||||
|
||||
def base_clone(attrs = {})
|
||||
clone.tap do |c| # dup
|
||||
dup.tap do |c|
|
||||
c.platform_id = nil
|
||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
||||
c.updated_at = nil; c.created_at = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue