app/models/project.rb
# allows a new project to be spawned off as a descendant of this project, retaining the same membership but existing
# as a new project entity. attributes may be passed to override those being copied. The ancestor and memberships will
# automatically be assigned and carried over, and the avatar will be set to nil
allows a new project to be spawned off as a descendant of this project, retaining the same membership but existing
as a new project entity. attributes may be passed to override those being copied. The ancestor and memberships will
automatically be assigned and carried over, and the avatar will be set to nil
allows a new project to be spawned off as a descendant of this project retaining the same membership but existing as a new project entity . attributes may be passed to override those being copied . The ancestor and memberships will automatically be assigned and carried over and the avatar will be set to nil
def spawn(attributes = {})
    child = dup
    work_groups.each do |wg|
      new_wg = WorkGroup.new(institution: wg.institution, project: child)
      child.work_groups << new_wg
      wg.group_memberships.each do |gm|
        new_gm = GroupMembership.new(person: gm.person, work_group: wg)
        new_wg.group_memberships << new_gm
      end
    end
    child.assign_attributes(attributes)
    child.avatar = nil
    child.lineage_ancestor = self
    child
  end
def spawn ( attributes = { } ) child = dup work_groups . each do | wg | new_wg = WorkGroup . new ( institution : wg . institution , project : child ) child . work_groups << new_wg wg . group_memberships . each do | gm | new_gm = GroupMembership . new ( person : gm . person , work_group : wg ) new_wg . group_memberships << new_gm end end child . assign_attributes ( attributes ) child . avatar = nil child . lineage_ancestor = self child end
allows a new project to be spawned off as a descendant of this project, retaining the same membership but existing
as a new project entity.
allows a new project to be spawned off as a descendant of this project retaining the same membership but existing as a new project entity .
attributes