Saturday, June 25, 2011

[Rails] has_many how to not create object without child?

I have Shop has_many documents.
I do not want create a Shop without almost one document associated.
That is: now I can do shop=Shop.create(.....) and shop.documents is
[], instead I don't want the possibility to create a shop without
almost one document.
How can I do this?

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate