Displaying 1 result from an estimated 1 matches for "primary_teach".
Did you mean:
primary_teacher
2006 Jan 23
3
create and update with has_many :through
...ough in my code. What
I''m trying to do is modify my create and update code to use the new
relationships. I''m using a table called course_teachers for the joins.
Here is what I have so far:
def create
@course = Course.new(params[:course])
@teacher = Teacher.find(params[:primary_teacher])
@course.teachers = @teacher
if @course.save
flash[:notice] = ''Course was successfully created.''
redirect_to :action => ''show'', :id => @course
else
render :action => ''new''
end
end
def update
@cou...