Displaying 1 result from an estimated 1 matches for "template_model".
2009 Feb 19
3
Associated child records not created on creation of a parent.
...ion
3. validates_presence_of :parent_id
4. acts_as_tree :foreign_key => "parent_id"
5. belongs_to :department
6. belongs_to :prototype_model
7. end
Code :
1. # POST /prototype_models
2. # POST /prototype_models.xml
3. def create
4.
5. @template_model = PrototypeModel.find( params
[:prototype_model][:parent_id] )
6. template_departments = @template_model.departments
7.
8. @prototype_model = PrototypeModel.new(params
[:prototype_model])
9. @prototype_model.author = current_user
10.
11. for mydepartment in template_depart...