Henry Oss wrote:
> I am trying to write a system with tables for engineers and system
> users.  Both are people.  It would seem that:
> 
> class Person < ActiveRecord::Base
> belongs_to :job, :polymorphic => true
> end
> 
> class Engineer < ActiveRecord::Base
> has_one :person, :as => :job
> end
> 
> class SystemUser < ActiveRecord::Base
> has_one :person, :as => :job
> end

Waiiiit...engineers and system users are *jobs*?  That's what your 
associations would seem to say, unless I'm misreading.

> 
> would be a way of doing that provided that the two groups did not
> overlap (which of course they do).  I am not at all keen to have
> engineer and system user attributes in the person table.

Do engineers and system users require different sets of fields in their 
respective tables?  If not, you could just unify them as a single Person 
class with a role field.

> 
> I am sure there is a very simple solution to this but so far research
> has come up with overly complicated answers.  Can anyone point me in the
> right direction?
> 
> Thanks in advance
> 
> Henry

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to