Fix platform clone. Refs #207
This commit is contained in:
parent
26299c234b
commit
a2c14313ed
|
@ -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