Displaying 1 result from an estimated 1 matches for "an_invoice".
2006 Jun 20
1
ActiveRecord saving madness?
...will be saved, and will have a nasty nil, which means that your rhtml
template will *fail* when going through that record.
You have to do this instead:
invoice = Invoice.new
# fill in the invoice
invoice.save!
an_order.invoice = invoice
As far as 1:0|1 specific "issues", if you do:
an_invoice = Invoice.new(...whatever...)
an_order.invoice = an_invoice
an_invoice will be automatically saved (why...?)
Finally, in order to keep this a 1:1 relationship, if you type:
invoice=new(...whatever...)
order.invoice=invoice
The "old" order.invoice will be modified, so that it will effe...