inline formsets?

hi,

I'm new to Rails (I'm comming from Django) and I'm looking for something equivalent to Django's Formsets (http:// docs.djangoproject.com/en/dev/topics/forms/formsets/) and Inline Formsets (Creating forms from models | Django documentation | Django #using-an-inline-formset-in-a-view)

does Rails have anything like this?

for those who don't know Django, a formset is an html form that represents several records at once, like this:

given an Article, a formset with 3 items would be like:

<form action="..."> <tr><th><label for="id_form-0-title">Title:</label></th><td><input type="text" name="form-0-title" value="Django is now open source" id="id_form-0-title" /></td></tr> <tr><th><label for="id_form-0-pub_date">Pub date:</label></

<td><input type="text" name="form-0-pub_date" value="2008-05-12"

id="id_form-0-pub_date" /></td></tr> <tr><th><label for="id_form-1-title">Title:</label></th><td><input type="text" name="form-1-title" id="id_form-1-title" /></td></tr> <tr><th><label for="id_form-1-pub_date">Pub date:</label></

<td><input type="text" name="form-1-pub_date" id="id_form-1-

pub_date" /></td></tr> <tr><th><label for="id_form-2-title">Title:</label></th><td><input type="text" name="form-2-title" id="id_form-2-title" /></td></tr> <tr><th><label for="id_form-2-pub_date">Pub date:</label></

<td><input type="text" name="form-2-pub_date" id="id_form-2-

pub_date" /></td></tr> .... </form>

(please, ignore the clutter. just the INPUT tags matter)

and when the request is submitted, I just have to do this in my controller to get it parsed:

ArticleFormSet = formset_factory(ArticleForm)     if request.method == 'POST':         formset = ArticleFormSet(request.POST)

(now, the formset object has a list of 3 Article objects)

thanks in advance,

Cesar

Hello, Cesar.

I started to learn Django and I' Ruby developer. Unfortunately Rails doesn't have something familiar out of the box. And you have to implement this from scratch. I recommend to use form objects fro this (again Rails doesn't provide them, so you have to implement them from scratch by yourself). Check out this railscast to be introduced to the

PS. Table in the view template should be written manually.