search for: parentscontroller

Displaying 1 result from an estimated 1 matches for "parentscontroller".

Did you mean: parent_controller
2006 Feb 23
3
has_many: inserting children when inserting parent
...s'' names. <%= text_field ''parent'', ''name'' %> <%= text_field ''childlist'', ''names'' %> Now the ParentController and its create method which I would like to save both the parent and all its childeren: class ParentsController < ApplicationController def create @parent = Parent.new(params[:parent]) @parent.save childnames = params[:childlist][:names] childname.split(/\s+/).each do |name| child = Child.new({ :parent_id => @parent.id, :name => name}) child.save @parent.children...