app/models/list.rb
#
# Update all the taxa in this list, or just a select few.  If taxa have been
# more recently observed, their last_observation will be updated.  If taxa
# were selected that were not in the list, they will be added if they've
# been observed.
#
Update all the taxa in this list, or just a select few.  If taxa have been
more recently observed, their last_observation will be updated.  If taxa
were selected that were not in the list, they will be added if they've
been observed.
Update all the taxa in this list or just a select few . If taxa have been more recently observed their last_observation will be updated . If taxa were selected that were not in the list they will be added if they ' ve been observed .
def refresh(options = {})
    find_options = {}
    if taxa = options[:taxa]
      find_options[:conditions] = ["list_id = ? AND taxon_id IN (?)", self.id, taxa]
    else
      find_options[:conditions] = ["list_id = ?", self.id]
    end
    ListedTaxon.do_in_batches(find_options) do |listed_taxon|
      listed_taxon.skip_update_cache_columns = options[:skip_update_cache_columns]
      listed_taxon.save
      unless listed_taxon.valid?
        Rails.logger.debug "[DEBUG] #{listed_taxon} wasn't valid, so it's being " +
          "destroyed: #{listed_taxon.errors.full_messages.join(', ')}"
        listed_taxon.destroy
      end
    end
    true
  end
def refresh ( options = { } ) find_options = { } if taxa = options [ :taxa ] find_options [ :conditions ] = [ "list_id = ? AND taxon_id IN (?)" , self . id , taxa ] else find_options [ :conditions ] = [ "list_id = ?" , self . id ] end ListedTaxon . do_in_batches ( find_options ) do | listed_taxon | listed_taxon . skip_update_cache_columns = options [ :skip_update_cache_columns ] listed_taxon . save unless listed_taxon . valid? Rails . logger . debug "[DEBUG] #{listed_taxon} wasn't valid, so it's being " + "destroyed: #{listed_taxon.errors.full_messages.join(', ')}" listed_taxon . destroy end end true end
Update all the taxa in this list, or just a select few.
Update all the taxa in this list or just a select few .
# re-apply list rules to the listed taxa
options