app/models/data_object.rb
# To retrieve an exact association(if exists) for the given taxon concept,
# otherwise retrieve an association with best vetted status.
# TODO - let's put this in Rails.cache to avoid the lookup more often. Clearing it will, of course, be a little tricky.
# Expiry should be one day.
To retrieve an exact association(if exists) for the given taxon concept,
otherwise retrieve an association with best vetted status.
TODO - let's put this in Rails.cache to avoid the lookup more often. Clearing it will, of course, be a little tricky.
Expiry should be one day.
To retrieve an exact association ( if exists ) for the given taxon concept otherwise retrieve an association with best vetted status . TODO - let ' s put this in Rails . cache to avoid the lookup more often . Clearing it will of course be a little tricky . Expiry should be one day .
def association_with_taxon_or_best_vetted(taxon_concept)
    @association_with_taxon_or_best_vetted ||= {}
    return @association_with_taxon_or_best_vetted[taxon_concept.id] if
      @association_with_taxon_or_best_vetted.has_key?(taxon_concept.id)
    assoc = raw_association(taxon_concept: taxon_concept)
    if assoc.blank?
      return @association_with_taxon_or_best_vetted[taxon_concept.id] = raw_association
    else
      return @association_with_taxon_or_best_vetted[taxon_concept.id] = assoc
    end
  end
def association_with_taxon_or_best_vetted ( taxon_concept ) @association_with_taxon_or_best_vetted ||= { } return @association_with_taxon_or_best_vetted [ taxon_concept . id ] if @association_with_taxon_or_best_vetted . has_key? ( taxon_concept . id ) assoc = raw_association ( taxon_concept : taxon_concept ) if assoc . blank? return @association_with_taxon_or_best_vetted [ taxon_concept . id ] = raw_association else return @association_with_taxon_or_best_vetted [ taxon_concept . id ] = assoc end end
To retrieve an exact association(if exists) for the given taxon concept,
otherwise retrieve an association with best vetted status.
To retrieve an exact association ( if exists ) for the given taxon concept otherwise retrieve an association with best vetted status .
taxon_concept
<not_specific>