On Tue, 26 Jul 2011 05:37:42 -0700 (PDT), Frederick Cheung wrote:
On Jul 26, 6:20 am, Rick F <[email protected]> wrote:
[ snipped ]
So -- is this sort of compound objecting possible in Rails or should
I
just eliminate the first two classes and add their respective fields
directly into Users?
Sounds like you want either validates_with, which enables you to
package up a set of validations into something reusable or
validates_associated, which would tell your user that when it
validates itself it should also validate the associated address
object.
Ok.. I'll check into that.. However, I'm still wondering if I can
have nested objects like I mentioned above -- e.g. a User object
containing an Address object and when it's time to write to the
database, both a User object is written but the associated Address
object is also written with some sort of foreign key between the two?
Just want to make sure before I proceed down a dead end path with
Rails. Does anyone architect your data that way or just have
duplicated data (e.g. an address for a user vs an address record for
a vendor vs ??)
Thanks!
--
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.