View with Variable Number of Fields

I’m a relative n00b when it comes to Rails. I’ve gone through Michael
Hartl’s tutorials (both editions, books and screencasts) and I can build
a
basic CRUD web app without help. However, for a personal project I’m
working on, I’m lost as to how to move forward. Here’s the situation …

I have a model called Project with two fields, name:string and due:date.
Project is associated (has_many) with a model called Task (with rows
description:text, status:text, and project_id:integer) which is
associated
back to Project with belongs_to. All this works fine.

What I’d really like to be able to do is click on a particular project
on
the Project#index page and be taken to a page that lets me enter as many
tasks as I need … not just one at a time. I’m wondering how I can do
this? Do I need to use AJAX or one of the popular JS frameworks?

Can anyone point me to an example of how to do this?

Thanks in advance!

On 3 July 2012 14:59, Clint326 [email protected] wrote:

What I’d really like to be able to do is click on a particular project on
the Project#index page and be taken to a page that lets me enter as many
tasks as I need … not just one at a time. I’m wondering how I can do this?
Do I need to use AJAX or one of the popular JS frameworks?

Can anyone point me to an example of how to do this?

These railscast [1] and [2] show how to do what I think you want,
however they are a bit out of date now. I see there are revised
episodes but to get that you have to pay :frowning:
Start by looking at those to get the basic idea.

Does anyone know of more up to date examples?

Colin

[1] #196 Nested Model Form Part 1 - RailsCasts
[2] #197 Nested Model Form Part 2 - RailsCasts