form with saved and new model instances

Hello all - I'm looking to create a form that would allow the editing
of existing model instances while also allowing new model instances to
be created. (its an order form where the model instances would be an
order line item joining the order to an item)
It looks like either one alone is easy, because in the former case the
field names would be foo[id] where the id is from the database, and in
the latter case, where the models are all new, it would be foo[index].
I'd like to add the new "empty" rows using some javascript which
should be easy, I just don't know how rails will approach the unsaved
rows in this case.
How does one mix these models? In my case, I can't create new "empty"
models for the new rows, because of some not null constraints in the
How do other folks deal with situations like this?

Thanks for any advice or comments