On 12 September 2010 03:47, Daniel Gaytán <[email protected]> wrote: > I think this could work: > > class Task < ActiveRecord::Base > belongs_to :worker > belongs_to :manager > end
That will work as long as the OP doesn't ever need a person to be a manager on one task, and a worker on another. Alternatively, create two foreign keys in Tasks and link them both to the Person model: class Task < ActiveRecord::Base belongs_to :worker, :foreign_key => "worker_id", :class_name => "Person" belongs_to :manager, :foreign_key => "manager_id", :class_name => "Person" end No STI is required, so there's more flexibility for the Person model. -- 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.

