Repeating fields on the same page

Does anyone know how I can repeat fields for a model (that would insert into different records) in a form? E.g.

<% form_for @thing, do |f| %>    <%= f.submit "DoIt" %>    <%= f.text_field :value %>    <%= f.text_field :value %> <% end %>

So that somehow when the user pressed "DoIt", the first value would go into a record in thing, and the second value would go into another record? Is this possible?

TIA, Craig

Does anyone know how I can repeat fields for a model (that would insert into different records) in a form? E.g.

<% form_for @thing, do |f| %> <%= f.submit "DoIt" %> <%= f.text_field :value %> <%= f.text_field :value %> <% end %>

So that somehow when the user pressed "DoIt", the first value would go into a record in thing, and the second value would go into another record? Is this possible?

As long as you give the fields different names (or nest them in a different scope, eg with fields_for), then yes. You just need to do different things with params[:thing][:value1] and params[:thing] [:value2] in your controller

Fred

You probably should have a look into :

Christophe

Thanks, Fred and Christophe. I had found the railscast on updating multiple fields, but that wasn't exactly what I was looking for. I'll watch the complex forms railscasts, mock up some code and get back to the group if I remain too stupid. Craig