Topic: Generating models from a parent by entering a single integer

Hi there,

I was wanting this  but could not be able to figure how to go about it..

I am creating an application that includes batch details that includes models called samples in it. Its a multi form and every  thing is being created by following Mr. Ryan.B 's tutorials. Now that I want some Ajax to go about.

I required in my form, a field that asks how many samples do they have per batch (one to many relation) and also

in the models batch.rb
i have has_many :samples
in the sample.rb
belongs_to :batch

Now once the user enters samples (for eg. 4, as an integer)  ... the form generates 4 fields for filling in information of the samples...

Is this possible by any means.. (it should be)..

Can any one help me with this... If suggestions like guides or books or even tutorials  would be wonderful, though Railcasts didnt have this...

thanks in advance