Class: Taxonomy

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/taxonomy.rb

Instance Method Summary collapse

Instance Method Details

#create_root_taxonObject



9
10
11
# File 'app/models/taxonomy.rb', line 9

def create_root_taxon
  self.taxons.create(:name => self.name + "__root")
end

#delete_taxonsObject

Doing this through a callback because it doesn’t rely on the destroy conditions of the taxons and makes deleting much more efficient



17
18
19
20
21
22
23
# File 'app/models/taxonomy.rb', line 17

def delete_taxons
  # TODO: More to do here. 
  # We probably will want to ensure that any items
  # assigned to the taxons get reassigned or cleaned
  # up appropriately.
  Taxon.destroy_all(:taxonomy_id => self.id)
end