app/models/taxon_concept/merger.rb
# NOTE: if you watch the logs, you will see a lot of individual
# TaxonConcept loads, which would be nice to avoid, but until we have a
# "bulk merger" class, this is the safest way to do it!
if you watch the logs, you will see a lot of individual
TaxonConcept loads, which would be nice to avoid, but until we have a
"bulk merger" class, this is the safest way to do it!
if you watch the logs you will see a lot of individual TaxonConcept loads which would be nice to avoid but until we have a " bulk merger " class this is the safest way to do it!
def ids(id1, id2)
        (id1, id2) = [id1, id2].sort
        new_concept = TaxonConcept.find_without_supercedure(id1)
        return new_concept if id1 == id2
        raise "Missing an ID (#{id1}, #{id2})" if id1 <= 0
        raise EOL::Exceptions::MergeToUnpublishedTaxon unless new_concept.published?
        old_concept = TaxonConcept.find_without_supercedure(id2)
        raise "Missing source concept (#{id2})" unless old_concept
        EOL.log("MERGE: concept #{id2} into #{id1}")
        taxon_concepts(new_concept, old_concept)
      end
def ids ( id1 , id2 ) ( id1 , id2 ) = [ id1 , id2 ] . sort new_concept = TaxonConcept . find_without_supercedure ( id1 ) return new_concept if id1 == id2 raise "Missing an ID (#{id1}, #{id2})" if id1 <= 0 raise EOL :: Exceptions :: MergeToUnpublishedTaxon unless new_concept . published? old_concept = TaxonConcept . find_without_supercedure ( id2 ) raise "Missing source concept (#{id2})" unless old_concept EOL . log ( "MERGE: concept #{id2} into #{id1}" ) taxon_concepts ( new_concept , old_concept ) end
NOTE: if you watch the logs, you will see a lot of individual
TaxonConcept loads, which would be nice to avoid, but until we have a
"bulk merger" class, this is the safest way to do it!
NOTE : if you watch the logs you will see a lot of individual TaxonConcept loads which would be nice to avoid but until we have a " bulk merger " class this is the safest way to do it!
# Always take the LOWEST id first; id1 is "kept", id2 "goes away"
id1
<not_specific>
id2
<not_specific>