app/models/taxon.rb
def geoprivacy(options = {})
    global_status = ConservationStatus.where("place_id IS NULL AND taxon_id IN (?)", self_and_ancestor_ids).order("iucn ASC").last
    if global_status && global_status.geoprivacy == Observation::PRIVATE
      return global_status.geoprivacy
    end
    geoprivacies = [global_status.try(:geoprivacy)].compact
    geoprivacies += ConservationStatus.
      where("taxon_id IN (?)", self_and_ancestor_ids).
      for_lat_lon(options[:latitude], options[:longitude]).pluck(:geoprivacy)
    return geoprivacies.first if geoprivacies.size == 1
    return Observation::PRIVATE if geoprivacies.include?(Observation::PRIVATE)
    return Observation::OBSCURED unless geoprivacies.blank?
    return Observation::OBSCURED if conservation_status.to_i >= IUCN_NEAR_THREATENED
    ancestors.where("conservation_status >= ?", IUCN_NEAR_THREATENED).exists? ? Observation::OBSCURED : nil
  end
# Sometimes you don't want to make a new taxon name with a taxon, like when
# you're saving a new taxon name with a new associated taxon. Hence, this.
Sometimes you don't want to make a new taxon name with a taxon, like when
you're saving a new taxon name with a new associated taxon. Hence, this.
Sometimes you don ' t want to make a new taxon name with a taxon like when you ' re saving a new taxon name with a new associated taxon . Hence this .
def geoprivacy(options = {})
    global_status = ConservationStatus.where("place_id IS NULL AND taxon_id IN (?)", self_and_ancestor_ids).order("iucn ASC").last
    if global_status && global_status.geoprivacy == Observation::PRIVATE
      return global_status.geoprivacy
    end
    geoprivacies = [global_status.try(:geoprivacy)].compact
    geoprivacies += ConservationStatus.
      where("taxon_id IN (?)", self_and_ancestor_ids).
      for_lat_lon(options[:latitude], options[:longitude]).pluck(:geoprivacy)
    return geoprivacies.first if geoprivacies.size == 1
    return Observation::PRIVATE if geoprivacies.include?(Observation::PRIVATE)
    return Observation::OBSCURED unless geoprivacies.blank?
    return Observation::OBSCURED if conservation_status.to_i >= IUCN_NEAR_THREATENED
    ancestors.where("conservation_status >= ?", IUCN_NEAR_THREATENED).exists? ? Observation::OBSCURED : nil
  end
def geoprivacy ( options = { } ) global_status = ConservationStatus . where ( "place_id IS NULL AND taxon_id IN (?)" , self_and_ancestor_ids ) . order ( "iucn ASC" ) . last if global_status && global_status . geoprivacy == Observation :: PRIVATE return global_status . geoprivacy end geoprivacies = [ global_status . try ( :geoprivacy ) ] . compact geoprivacies += ConservationStatus . where ( "taxon_id IN (?)" , self_and_ancestor_ids ) . for_lat_lon ( options [ :latitude ] , options [ :longitude ] ) . pluck ( :geoprivacy ) return geoprivacies . first if geoprivacies . size == 1 return Observation :: PRIVATE if geoprivacies . include? ( Observation :: PRIVATE ) return Observation :: OBSCURED unless geoprivacies . blank? return Observation :: OBSCURED if conservation_status . to_i >= IUCN_NEAR_THREATENED ancestors . where ( "conservation_status >= ?" , IUCN_NEAR_THREATENED ) . exists? ? Observation :: OBSCURED : nil end
Sometimes you don't want to make a new taxon name with a taxon, like when
you're saving a new taxon name with a new associated taxon.
Sometimes you don ' t want to make a new taxon name with a taxon like when you ' re saving a new taxon name with a new associated taxon .
options