lib/catissue/database.rb
def add_position_to_specimen_template(specimen, template)
      pos = specimen.position
      # the non-domain position attributes
      pas = pos.class.nondomain_attributes
      # the template position reflects the old values, if available
      ss = pos.snapshot
      # the attribute => value hash
      vh = ss ? pas.to_compact_hash { |pas| ss[pas] } : pos.value_hash(pas)
      vh[:specimen] = template
      vh[:storage_container] = pos.storage_container.copy
      # the template position reflects the old values
      template.position = pos.class.new(vh)
      logger.debug { "Work around #{specimen} update anomaly by copying position #{template.position.qp} to update template #{template.qp} as #{template.position.qp} with values #{vh.qp}..." }
    end
def add_position_to_specimen_template(specimen, template)
      pos = specimen.position
      # the non-domain position attributes
      pas = pos.class.nondomain_attributes
      # the template position reflects the old values, if available
      ss = pos.snapshot
      # the attribute => value hash
      vh = ss ? pas.to_compact_hash { |pas| ss[pas] } : pos.value_hash(pas)
      vh[:specimen] = template
      vh[:storage_container] = pos.storage_container.copy
      # the template position reflects the old values
      template.position = pos.class.new(vh)
      logger.debug { "Work around #{specimen} update anomaly by copying position #{template.position.qp} to update template #{template.qp} as #{template.position.qp} with values #{vh.qp}..." }
    end
def add_position_to_specimen_template ( specimen , template ) pos = specimen . position # the non-domain position attributes pas = pos . class . nondomain_attributes # the template position reflects the old values, if available ss = pos . snapshot # the attribute => value hash vh = ss ? pas . to_compact_hash { | pas | ss [ pas ] } : pos . value_hash ( pas ) vh [ :specimen ] = template vh [ :storage_container ] = pos . storage_container . copy # the template position reflects the old values template . position = pos . class . new ( vh ) logger . debug { "Work around #{specimen} update anomaly by copying position #{template.position.qp} to update template #{template.qp} as #{template.position.qp} with values #{vh.qp}..." } end
Adds the specimen position to its save template.

 @param [CaTissue::Specimen] specimen the existing specimen with an existing position
 @param template (see #save_with_template)
 @see {#save_with_template}
Adds the specimen position to its save template .