I’m trying to create a form/view that displays a mix of records that
exist in the database and records that the user is working on but that
don’t yet exist in the database. I want to leverage all of rails’ nice
form helpers, especially the params hash that it generates for the
records when the form is submitted. So - I am creating ‘dummy’ records
with fake ids to represent the new records that don’t really exist in
I’m getting wrapped around the axle when I try and submit the form. I
need to identify the pre-existing records and just save them back to
the database with any modified data. For the new records, I need to
create them fresh and then save them to the database.
I’ve been trying all sorts of clever tricks to identify the new
records based on their fake ids, but I keep running into difficulties.
I’m wondering if there is a simple convention for handling this
scenario that I am missing, or if this is just one of those scenarios
that requires a lot of work to make it work properly.
Any guidance would be appreciated.