From f2aacd51405724cdf7cfd36a439c9dbfce16973a Mon Sep 17 00:00:00 2001 From: Eloy Duran Date: Fri, 8 Jan 2010 20:47:49 +0100 Subject: Rollback the transaction when one of the autosave associations fails to save. [#3391 state:resolved] --- activerecord/test/models/ship.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/test/models/ship.rb') diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb index a96e38ab41..75c792d176 100644 --- a/activerecord/test/models/ship.rb +++ b/activerecord/test/models/ship.rb @@ -9,4 +9,10 @@ class Ship < ActiveRecord::Base accepts_nested_attributes_for :update_only_pirate, :update_only => true validates_presence_of :name + + attr_accessor :cancel_save_from_callback + before_save :cancel_save_callback_method, :if => :cancel_save_from_callback + def cancel_save_callback_method + false + end end -- cgit v1.2.3