Evan Chaney wrote:
>> That way you can't save a conversation without assigning it a leader,
>> but the leader doesn't have to be saved yet.
> 
> Well, that�s where I�m at right now. I�d like to be in a situation where 
> Conversation validates that it has a Leader and Leader validates it has 
> a Conversation before either is saved.
>

Just validate that there are keys: Conversation validates_presence_of 
:leader, Leader validates_presence_of :conversation (perhaps).  Do the 
rest with foreign key constraints in the DB.  As you've discovered, the 
application layer is the wrong place for this sort of simple integrity 
check.

> --
> 
> You received this message because you are subscribed to the Google 
> Groups "Ruby on Rails: Talk" 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-talk?hl=en.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en.


Reply via email to