Displaying 1 result from an estimated 1 matches for "recordnotvalid".
2007 Nov 21
0
Testing transactional updates in story runner
...have an action that needs to update four different models:
Enrollment.transaction do
@contact.update_addresses(params[:contact_address], params
[:billing_address])
@enrollment.update_attributes!(params[:enrollment])
end
The last update_attributes! will raise ActiveRecord::RecordNotValid
if anything was invalid (it cascades to contact and further to
addresses), and thus cause a rollback, so either all the updates go
through or none of them. This works fine in development and production.
However, in story runner the whole story is put inside a big
transaction and further a...