Forum: Ruby on Rails Is it time for transactions yet?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Efe398b3b5436b0a8d4430090e8f86ea?d=identicon&s=25 subimage (Guest)
on 2005-11-29 11:58
(Received via mailing list)
I've started on my second rails project, one which is a little more
than my first.

In this, I've designed a DB to handle orders from an online store. My
are comprised of records that span across 4 tables or so. I've not used
transactions to this point in rails, and I'm wondering if now is the
time to

I was under the impression that if I used the syntax below to create my
records they all would be saved at the same time. Can anyone look over
real quickly and tell me what I'm doing wrong? I'm only getting
saved, when I thought all the associated records should be persisted as

Here's the code:
  # Creates an order from new.
  def create
    @order_user =[:order_user])

    @order =[:order])

    @billing_address =[:billing_address])

    if params[:use_separate_shipping_address] then
      @shipping_address =[:shipping_address])
      # Don't create shipping address as a child of order_user
      # Need to re-create it here in case save fails.
      # In that case, it needs to be present to display for the "new"
      @shipping_address =[:shipping_address])

    @order_account =[:order_account])

    # Transaction support here?
      flash[:notice] = 'Order was successfully created.'
      redirect_to :action => 'list'
      render :action => 'new'

As always, many thanks in advance...
This topic is locked and can not be replied to.