| Class | Animal |
| In: |
app/models/animal.rb
|
| Parent: | ActiveRecord::Base |
schema.rb snippet:
create_table "animals", :force => true do |t|
t.column "position", :integer
t.column "description", :text
t.column "noun_class_id", :integer
t.column "kind_id", :integer
end
Unlike other nameable items, the main part of animals names is most commonly preceded by qualifying adjectives, so it makes most sense to allow for a wildcard at the beginning rather than the end of the names_like search. i.e. a search for names_like ‘Pigeon’ should return ‘Common Bronzewing Pigeon‘
# File app/models/animal.rb, line 40
40: def Animal.names_like name_string
41: Name.find(:all, :conditions => [ "object_type = ? AND LOWER(name) LIKE ?",
42: self.to_s, '%' + name_string.downcase])
43: end
Returns the ABC for an animal, which is only appropriate for Groote. Could be generalised or done away with completely.
# File app/models/animal.rb, line 25
25: def disambiguation
26: classification = self.classifications.find(:first, :conditions => "system = 'Anindilyakwa Biological'")
27: disambiguation_parts = []
28: disambiguation_parts << classification.hierarcy.join(" -> ") rescue ""
29: disambiguation_parts << "like " + classification.siblings.first.animals.first.primary_names rescue ""
30: if disambiguation_parts.empty?
31: return nil
32: end
33: return disambiguation_parts.join(" ")
34: end