Re: validates_associated trouble

Alfredo Gama
Wed, 21 Feb 2007 13:11:46 -0000

Mark Reginald James wrote:
> Alfredo Gama wrote:
>>   validates_associated :sire, :dam
>> then when i save a new animal the validate doesnt work like this:
>> insert(3,C,5,7)   its ok too, (the validates is doesnt work)
>>
>> how can i solve this??
>
> Use validates_presence_of instead of validates_associated.
>
> Or use in addition to validates_associated if you want to
> check some attributes of the associates.
>
>
> --
> We develop, watch us RoR, in numbers too big to ignore.

Thanks friend.

the problem is that in some cases an Animals has not father or mother,
then how can i do it??