# Newbe question on view for a 1:n model

**URL:** <https://www.ruby-forum.com/t/newbe-question-on-view-for-a-1-n-model/180683>\
**Category:** Rails\
**Created:** [December 25, 2009, 7:57pm UTC](https://www.ruby-forum.com/t/newbe-question-on-view-for-a-1-n-model/180683 "2009-12-25T19:57:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trapper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/2acd7d/32.png) [@trapper](https://www.ruby-forum.com/u/trapper)\
**Post date:** [December 25, 2009, 7:57pm UTC](https://www.ruby-forum.com/t/newbe-question-on-view-for-a-1-n-model/180683/1 "2009-12-25T19:57:16Z")

</div>

I want do build a view for a 1:n model for funtion new.

Rendering the form for the attributes of the independent (1) record is  
done automatically.

But how to create the variable number of inputs for the dependent (n)  
records?

---

<div class="post-metadata">

**Author:** ![trapper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/2acd7d/32.png) [@trapper](https://www.ruby-forum.com/u/trapper)\
**Post date:** [December 26, 2009, 9:18am UTC](https://www.ruby-forum.com/t/newbe-question-on-view-for-a-1-n-model/180683/2 "2009-12-26T09:18:00Z")

</div>

On Dec 26, 2:57 am, Fritz T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I want do build a view for a 1:n model for funtion new.
> 
> Rendering the form for the attributes of the independent (1) record is  
> done automatically.
> 
> ## But how to create the variable number of inputs for the dependent (n) records?
> 
> Posted viahttp://www.ruby-forum.com/.

Look for the railscast series on complex forms (# 73-75).

In a nutshell you’ll need to use Ajax to dynamically add input  
elements and pass all the values of those elements to the controller  
in an array.

–

You received this message because you are subscribed to the Google  
Groups “Ruby on Rails: Talk” group.  
To post to this group, send email to removed\_email\_address@domain.invalid.  
To unsubscribe from this group, send email to  
removed\_email\_address@domain.invalid.  
For more options, visit this group at  
[http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
