[Rails] Re: does rails enforce referential integrity???

Łukasz Piestrzeniewicz bragi.ragnarson+rf at gmail.com
Sun Aug 13 21:57:59 GMT 2006


Rick Martinez wrote:

> I was wondering something related to this question. With foreign keys in 
> PostgreSQL, if I update an ID for a table, it will update all related 
> IDs for other tables associated with it. Is something like this possible 
> for rails?

Wow. ID is The Identity. It's not the name or nick. It's the very 
essence of being. Why would you like to change that?! I for example 
would be very mad if you would try to change my identity just to fool 
all my aquintances! You are trying to do something very very bad.

No. Luckly Rails does not allow such mischief. If you want to exchange 
one object with another you have to manually go to his every pal and 
say: I no longer like this old object and I want you to use this shiny 
new one instead. Which is a good thing because if you try to give them 
something they do not like they will, nomen omen, object.

This gives your application a lot better protection than referential 
integrity.

Cheers,
Bragi

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list