I don't understand your question ...
Is id_sire the id of the father ? And id_dam the id of the mother ?
I don't understand your question ...
Is id_sire the id of the father ? And id_dam the id of the mother ?
I think you want to declare your model this way:
class Animal < ActiveRecord::Base
belongs_to :sire, :class_name => 'Animal', :foreign_key => 'id_sire'
belongs_to :dam, :class_name => 'Animal', :foreign_key => 'id_dam'
end
then in your view:
id, name, sire, dam
<%= animal.id %> <%= animal.name %> <%= animal.sire.name unless
animal.sire.nil? %> <%= animal.dam.name unless animal.dam.nil? %>