Hi all.. Just trying out Rails for the first time.. I've got a project
I'd like to port over from another environment and am just not sure
how to achieve the same sort of OO goodness I'm used to.. In my other
environment, I've declared a few classes similar to the following
(these are only a few of the overall classes):

class Address :
   street : string
   city : string
   state : string
   zip : string
   email : string
   phone : string

class Name :
   lastname : string
   husband : string
   wife : string
   children : array of strings

class User
   acctLocked : boolean
   address : Address (object)
   isProfileSetup : boolean
   lastLogin : datetime
   name : Name (object)
   userType : enum(#regular, #admin)

In this case, my old environment allowed me to create validation logic
associated
with each class so I didn't have to reproduce (for instance) address
validation logic for the various classes (not present here) that had
address records -- all was encapsulated within a single class to
reduce/eliminate redundant code.

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?

Also, if I want to set a max field size for some of the strings (for
validation purposes or otherwise), what's the best way to do that to
ensure my generated SQL limits string length to 2 characters for state
(for instance)?

Please keep in mind that I've only been playing with Rails for about 2
hours, so I'm still learning..

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.

Reply via email to