Displaying 1 result from an estimated 1 matches for "prototype_models".
Did you mean:
prototype_model
2009 Feb 19
3
Associated child records not created on creation of a parent.
...1. class Department < ActiveRecord::Base
2. validates_presence_of :name, :description
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....