Forum: Ruby on Rails Multiple records, both save and create

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tookelso T. (Guest)
on 2006-03-21 06:06
Hello,

I have a time-entry system which I'm creating, and would like to know
the best way to code a form where users can modify *and* create new
records.

The screen will show time entries for the day.  The user can modify
existing entries, as well as enter new ones.

Here's a sample screen:

Hours:     Description:
4          Project 1
2          Project 2
X          --------
X          --------

The user can change the existing records, as well as enter new ones.
There should always be four or five blank records like the ones marked
"X" above.

I just want one "Submit" button on the form.

I suspect there are two ways of accomplishing this:
1) When the user presses "Submit", just zap all records from a given
day, and re-create the newly submitted time entries.
or

2) Update the records that already exist, and create the records that do
not yet have IDs.

Does anyone have a bird's eye solution to this?  For example, do I use
my controller's "Create" or "Save" method to do this?

Thanks,

--Tookelso
This topic is locked and can not be replied to.