hey guys,

Basically i've already setup a many-to-many relationship between the 2
models and setup a Intermediate join Table without a primary_key on
the join table.

so i've done this

class Student < ActiveRecord::Base
       has_and_belongs_to_many :teachers
end

and

class Teachers < ActiveRecord::Base
       has_and_belongs_to_many :students
end

i've also created the following table

students_teachers

with the columns teacher_id and student_id

however when I try to create a student (logged in as the teacher
trying to create student record)

Where in the Student#Create Controller i am doing

 @teacher = Teacher.where(['id=?',
session[:logged_teacher].techerId]).first
 @student = @teacher.students.build(params[:student])

however when I try to create the user and save in the database the
record is being created in the student table however the Join Table is
not being populated.  Am I doing something wrong here? am I missing
out on something?

Thx

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