Creating more than 1 child for an already existing parent

hi all,

     i have a parent by namr "consultancy"

I want to create more than 1 child models for analready existing
consultancy which has some extra feilds

Plz help me in this regard.

2009/8/31 Kart [email protected]:

hi all,

    i have a parent by namr “consultancy”

I want to create more than 1 child models for analready existing
consultancy which has some extra feilds

Do you mean that you have
Consultancy has_many :children

and you now want to change the Child model so that it has extra fields?

Colin

Hi Colin,

Yes, Consultancy has_many :children

but what i want to do is creating many childrens in the same form for
an already existing consultancy.

plz help me in this regard

2009/8/31 Kart [email protected]:

Hi Colin,

Yes, Consultancy has_many :children

but what i want to do is creating many childrens in the same form for
an already existing consultancy.

You want to look at Nested Forms I think. The rails guide Getting
Started (I presume you have worked through the guides?) gives a brief
introduction to this and google will provide many links.

Colin

2009/8/31 Kart [email protected]:

thanks Colin

but The children is a single model(single DB table)

and what i want to do is create multiple instance of children from a
single form with validation for the child fields

That is what Nested Forms do. See section 9 in the getting started
guide.

Colin

thanks Colin

but The children is a single model(single DB table)

and what i want to do is create multiple instance of children from a
single form with validation for the child fields

but the normal new and create method doesn’t provide for creating
multiple innstance of a model in single form ,It just provides
creating a single instance

You can see Railscasts #73, #74, #75 which deals with the same problem.
Also searching on any search engine will also help.


Thanks,
Abhinav
http://twitter.com/abhinav

Thanks a lot Colin …

thanks a lot colin