I think the differences between Customer and Employee is Role, when you
assign a 'customer' role, he is a customer.

So you could use Role to distinguish different person, and a person may have
many roles

class User < ActiveRecord::Base
  has_many :roles
  has_many :addresses
end

On Mon, Mar 29, 2010 at 5:43 PM, Paritian Thakkar <[email protected]>wrote:

> Hello Friends,
>
> I am trying to define relationship between real-world entities in my
> application.... But I am feel, I am over-representing it a little and
> hence would like your opinion.
>
> class User < ActiveRecord::Base
>  has_and_belongs_to_many :user_groups
>
>  attr_accessible :username, :email, :password, :password_confirmation
>
> end
>
> class Customer < User
>  has_many :orders
>
>  belongs_to :person
> end
>
> class Employee < User
>  belongs_to :person
>
> end
>
> class Person < ActiveRecord::Base
>  has_many :addresses
> end
>
>
> Should I merge User and Person Models? Basically user has only login
> information while Person has details like first_name, last_name, address
> and so on....
>
> Also, should Customer and Employee inherit from Person or User? Trying
> to normalize stuff but dont want to over-normalize it too..
>
> Thank you.
> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://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 [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