Displaying 1 result from an estimated 1 matches for "toxin_citations_for_taxon".
2007 Oct 18
0
Getting the through items from a has_many :through :uniq relationship
...has_many :data_objects
has_many :taxon_toxin_citations
has_many :toxins, :through => :taxon_toxin_citations, :uniq=> TRUE
so all I have to do is ask for taxon.toxins
But to get the list of citations/data objects linking a specific taxon
with each toxin is a bit trickier. I currently have
toxin_citations_for_taxon = {}
taxon.toxins.each do |toxin|
taxon_toxin_citations =
TaxonToxinCitation.find_all_by_taxon_id_and_toxin_id(taxon, toxin)
toxin_citations_for_taxon[toxin] = []
taxon_toxin_citations.each do |taxon_toxin_citation|
toxin_citations_for_taxon[toxin] <<
taxon_toxin_citation.data_objec...