On Mon, Feb 7, 2011 at 11:58 AM, Xavier Noria <[email protected]> wrote:
> On Sun, Feb 6, 2011 at 2:10 PM, Rainer Frey <[email protected]> wrote:
>
>> Unfortunately the Rails Guide on Active Record Validation and
>> Callbacks says (Section 3.9):
>> "If you want to be sure that an association is present, you’ll need to
>> test whether the foreign key used to map the association is present,
>> and not the associated object itself."
>>
>> Maybe the guide needs to be updated.
>
> Yeah, I think the wording is unfortunate. Certainly you can't be sure
> the association is present by checking that the FK attribute is
> present.
>
> Rather, this topic deserves a warning in my view. Something in the
> line that if you check whether the FK attribute is present then you
> *don't know* whether it is valid. You can decide to take the risk,
> that's up to you, but the reader should be warned.

But this thread seems to suggest one should simply validate the
association attribute instead. Is that not sufficient then?

> If you'd like to have a stab at any of these revisions please give it
> a go through docrails.

Sorry, my understanding is too limited.

Rainer

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to