# Nested partial model input forms:

**URL:** <https://discuss.rubyonrails.org/t/nested-partial-model-input-forms/65469>\
**Category:** rubyonrails-talk\
**Created:** [October 17, 2012, 6:38am UTC](https://discuss.rubyonrails.org/t/nested-partial-model-input-forms/65469 "2012-10-17T06:38:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [October 17, 2012, 6:38am UTC](https://discuss.rubyonrails.org/t/nested-partial-model-input-forms/65469/1 "2012-10-17T06:38:48Z")

</div>

Rails 3.1.3

I have a model, "Plan" that has columns :flight\_name\_id(integer). From the user point of view, searching flights from the places of departure and destination is in fact logically reasonable. So, my forms ask users to input places first, then Ajax updates the available flight plans in the select forms that follow. (Ajax functionality works well, though)

But "Plan" model only needs flight\_name to be stored, so both departure and destination forms should not be model oriented. The following code gives an error,

&nbsp;&nbsp;undefined method `departure\_id'

\<%= semantic\_form\_for @plan do |f| %\> &nbsp;&nbsp;\<%= f.inputs do %\> &nbsp;&nbsp;&nbsp;&nbsp;\<%= f.input :departure\_id, :as =\> :select, &nbsp;&nbsp;:collection =\> City.find(:all, :order=\>:name).collect{ |c| [c.name,c.id]}, &nbsp;&nbsp;:required=\>true %\> &nbsp;&nbsp;&nbsp;&nbsp;\<div id="destinationCity"\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= render :partial =\> 'destination' %\> &nbsp;&nbsp;&nbsp;&nbsp;\</div\> &nbsp;&nbsp;&nbsp;&nbsp;\<div id="flight\_name"\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= render :partial =\> 'flight\_name' %\> &nbsp;&nbsp;&nbsp;&nbsp;\</div\> ...

Certainly, a similar error will appear for destination as well even if this error is resolved.

Somehow, I need a set of nested forms that is a mixture of form\_for and form\_tag (?) if I am correct.

My question is :

&nbsp;&nbsp;How can I make a collection of select forms including both form\_tag and form\_for ?

Thanks

soichi
