I have used STI before and although it works I am not that crazy about it and in this case I don't think it can be applied because one person *could* be both a user and a customer.
I like the concept of the abstract Person model, though. I didn't think about that one and I think it's a good idea. Any links to a sample of how to use abstract classes? I've never used them before. Thanks! On May 18, 9:26 am, Ar Chron <li...@ruby-forum.com> wrote: > pepe wrote: > > > I have thought about factoring out the name to a separate model: > > Most of this decision depends on how you intend to treat your Users and > Customers. Perhaps you just have people, with a flag attribute on each, > or people with related models of Customer-specific info and > User-specific info. Is a User really different from a Person (will you > track people who aren't users or customers - if so, then Person isn't > abstract)? But only you know the answers to these questions. > > I think of names (first, last, middle, full, nickname, etc) as > attributes of some model, not a model of its own... > > Sounds like you *could* have a base (abstract) class of Person, then do > > class Person < ActiveRecord::Base > self.abstract_class = true > # common methods go here > end > > class User < Person > # User table has all the fields it needs > # User specific methods go here > blah blah blah > > end > > class Customer < Person > # Customer table has all the fields it needs > # Customer specific methods go here > blah blah blah > end > > if Users and Customers really, really are different entities. > > You could also go the STI route... > -- > Posted viahttp://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 rubyonrails-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.