Henry Happ wrote:
> If it's not too bold to ask, could you please explain in a more concrete 
> way how to implement the structure describe in Rails?

Well...  I'd start with a modeling exercise to figure out what are the 
attributes of a:
A Prospective Student <- Maybe prospects are kept segregated from People 
for the sheer reason that you may have a bazillion prospective students 
of which you have comparatively few who are ever of concern to your 
application later (as students).

An Applicant  <- I think I'd use an Applications model (related to a 
Prospective Student), not the person as an applicant. An applicant is 
just a Prospective Student who sent in a bit of paper and a check... 
maybe more than once. If they become a Student, then relate the 
application data to the student record created from the prospective 
student.

A Student, A Teacher, A Whatever - These models would have substantive 
amounts of data not shared by each other, or Person.

A Mentor  <- being a mentor may not be a type of person, but rather a 
name for a participant in an instance of a mentoring relationship 
between two people (I'm not sure being a mentor adds much information 
about the Person in addition to the existence of the relationship).

Then distill those common attributes into a Person model. What's left 
over from each type of person you create would go into a new model for 
that perspective of a person. Each of those models would contain a 
person_id field to get back to the person (and use a "belongs_to 
:person" in the model.rb).  Person.rb would have a has_one :something 
for each of these related models... something like:

class ProspectiveStudent < ActiveRecord::Base
  has_many :applications
end

class Application < ActiveRecord::Base
  belongs_to :prospective_student
  belongs_to :student
end

class Person < ActiveRecord::Base
  has_one :student
  has_one :teacher
end

class Student < ActiveRecord::Base
  belongs_to :person
  has_one :application   # in terms of applications, one got the person 
to become a student...  when prospective student becomes student, 
current application gets flagged for student
  # table contains person_id : integer, and other info for students
end

class Teacher < ActiveRecord::Base
  belongs_to :person
  # table contains person_id : integer, and other info for teachers
end

Or something like that...
-- 
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