Fix platform clone. Refs #207
This commit is contained in:
parent
26299c234b
commit
a2c14313ed
|
@ -104,11 +104,10 @@ class Platform < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def base_clone(attrs = {}) # :description, :name, :owner
|
def base_clone(attrs = {}) # :description, :name, :owner
|
||||||
clone.tap do |c|
|
dup.tap do |c|
|
||||||
# c.attributes = attrs #
|
attrs.each {|k,v| c.send("#{k}=", v)} # c.attributes = attrs
|
||||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
c.updated_at = nil; c.created_at = nil
|
||||||
c.updated_at = nil; c.created_at = nil # :id = nil
|
c.parent = self; c.released = false
|
||||||
c.parent = self
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,10 @@ class Product < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def full_clone(attrs = {})
|
def full_clone(attrs = {})
|
||||||
clone.tap do |c| # dup
|
dup.tap do |c|
|
||||||
c.platform_id = nil
|
c.platform_id = nil
|
||||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ class Repository < ActiveRecord::Base
|
||||||
attr_readonly :name, :platform_id
|
attr_readonly :name, :platform_id
|
||||||
|
|
||||||
def base_clone(attrs = {})
|
def base_clone(attrs = {})
|
||||||
clone.tap do |c| # dup
|
dup.tap do |c|
|
||||||
c.platform_id = nil
|
c.platform_id = nil
|
||||||
attrs.each {|k,v| c.send("#{k}=", v)}
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue