Skip to content

Commit

Permalink
revert self remove
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Nov 11, 2019
1 parent 3199754 commit 59ec137
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/models/container_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ def container=(object)
if parent
parent.contained_object = object
else
parent = ContainerItem.new(contained_object: object)
# This self required?!
self.parent = ContainerItem.new(contained_object: object)
end

parent.save! if !parent.new_record?
self.parent.save! if !parent.new_record?
save! unless new_record?
end
end
Expand All @@ -81,17 +82,17 @@ def container_id=(value)
if parent
parent.contained_object = c
else
parent = ContainerItem.new(contained_object: c)
self.parent = ContainerItem.new(contained_object: c)
end

parent.save! if !parent.new_record?
self.parent.save! if !parent.new_record?
save! unless new_record?
end

# @return [container]
# the container for this ContainerItem
def container
reload_parent.try(:contained_object) || Container.none
reload_parent.try(:contained_object)
end

# @return [GlobalID]
Expand Down

0 comments on commit 59ec137

Please sign in to comment.