Forum: Ruby on Rails inline formsets?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
02febcc7d5b8bd06cd813d3d3d4500aa?d=identicon&s=25 Cesar Devera (Guest)
on 2011-01-03 13:00
(Received via mailing list)

I'm new to Rails (I'm comming from Django) and I'm looking for
something equivalent to Django's Formsets (http:// and Inline
Formsets (

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></
th><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></
th><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></
th><td><input type="text" name="form-2-pub_date" id="id_form-2-
pub_date" /></td></tr>

(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,

6228fc7c96122d25c088b7dee54db273?d=identicon&s=25 Andrey Koleshko (ka8725)
on 2014-03-13 22:47
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.
This topic is locked and can not be replied to.