Broadly speaking, this is a business decision so it belongs where the
BL resides -- in the model layer. Depending on how your models are
related, some of that may be taken care of for you through the
association proxies. For example, if Header has_many :details (Detail
belongs_to :header) then...
@header = Header.new( ... )
@detail = @header.details.build( ... )
The @header.save above will create the header and detail records
wrapped in a DB connection.
If you want more explicit control over the transaction then you can
use the #transaction method of the ActiveRecord (model) objects.
header.update_attributes( ... )
detail.update_attributes( ... )
For more info check the Rails API here: