Hello,
Maybe someone can help me. I am trying to get my head around Lesson 10
Active Record Association basic. I am comfortable with the information
that goes into the model (has_many or belong_to) I am very comfortable
with that. But I get lost within the controller and the Views. I can
replicate this example but when I try a different example then I get
confused. So maybe someone can explain it with a different example.

So imagine I have 2 models, a person and a student model. The student
model belongs to the person model.
So lets assume the person model has (lastname, firstname and sex)
while the student model has(studentID, address, yr)

class Person < ActiveRecord::Base
  validates_presence_of :lastname, :firstname, :sex
  has_many :students
end
class Student < ActiveRecord::Base
  validates_presence_of :studentID, :address, :yr
  belongs_to :person
end

This is where I get confused. I have used scaffolding for both the
person and the student. So what if I want to be able to create a
person, then during that process have an option to create a student
that belongs to that particular person model. How can I modify the
controller and also the views that's were I am stuck.

If my example is not concrete enough someone can suggest a different
example to explain the concept.

I really appreciate it.
Thanks
Ike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to