this is my model
   class Person < ActiveRecord::Base
  end
class parent < Person
end
class Student < person
end
class principal<person
end

i have table called people.
iam adding all the details of parent and student and principal in the
same table.

my form is
     <% form_for :student do %>
             <td><%= text_field  :first_name,  :label => "Student" %>
              <td><%= text_field  :last_name %></td>

         <% fields_for :parent %>
                 <tr>
                  <td><%= text_field  :first_name,  :label => "Parents/
Guardian" %></td>
                  <td><%= text_field  :last_name %></td>
               </tr>
               <tr>
                   <td><%= text_field :email, :label => "Email" %></td>
               </tr>
               <tr>
                  <td><%= text_field  :phone,  :label => "Phone" %></td>
               </tr>
         <% end %>
    <% end %>

In the New action i have provided like

     def new
     @student = Student.new
     @parent = Parent.new

  end

my fields in people table are
     t.column :type, :string
      t.column :first_name, :string
      t.column :last_name, :string
    t.column :email, :string
      t.column :phone, :string
      t.column :address, :text

how can we add the student details(first_name, last_name) and the
parent details(first_name, last_name, email, phone) at the same time
with in the same table called people.



--~--~---------~--~----~------------~-------~--~----~
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