Validates_associated trouble

Hello,

I need to modelate a genealogical tree with:
animal,Dam(Mother) and Sire(Father)

the Dam and Sire are Animals then i modelate this:

class Animal < ActiveRecord::Base
belongs_to :sire
belongs_to :dam
validates_associated :sire, :dam
end

class Sire < Animal
has_many :animals
end

class Dam < Animal
has_many :animals
end

then when i save a new animal the validate doesnt work like this:

i have the table Animals

ID, Name Father MOther
1 A - -
2 B - -

when I insert a new record like this

insert(3,C,1,2) its ok!
insert(3,C,5,7) its ok too, (the validates is doesnt work)

how can i solve this??

On Wed, 21 Feb 2007 04:25:11 +0100, Alfredo G. [email protected]
wrote:

[snip] ActiveRecord::Base [snip]

Try the Rails mailing list
[http://lists.rubyonrails.org/mailman/listinfo/rails] for this.

Also, I’m so ripping off the word “modelate”.

David V.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs