Search code examples
ruby-on-rails-3modelrecords

Create multiple records in one form with one model - No not nested forms or anything


Hi I've searched for a nice tut showing me how I can create multiple data into one single model with one form. I only find really advance nested forms with a lot of functionality that I believe I don't need.

Can someone give me a direction on how to do this.

I have these two models. Products with many prices Prices that belongs to products

Now I want to do a form that can create prices for every product in one single action. Maybe there is a nice tutorial out there on this, but I can't find it...

Thanks in advance.


Solution

  • You want nested forms, though they don't have to be complicated.

    See the relevant Railscast for a great introduction to these. http://railscasts.com/episodes/196-nested-model-form-part-1