aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/ship.rb
diff options
context:
space:
mode:
authorEloy Duran <eloy.de.enige@gmail.com>2010-01-08 20:47:49 +0100
committerEloy Duran <eloy.de.enige@gmail.com>2010-01-08 21:45:02 +0100
commitf2aacd51405724cdf7cfd36a439c9dbfce16973a (patch)
treed12d882bca639002b7a8e4c8b7be537efe7c7d4b /activerecord/test/models/ship.rb
parent5193fe9dd730f9bbb72db055f37625fe9558b6ca (diff)
downloadrails-f2aacd51405724cdf7cfd36a439c9dbfce16973a.tar.gz
rails-f2aacd51405724cdf7cfd36a439c9dbfce16973a.tar.bz2
rails-f2aacd51405724cdf7cfd36a439c9dbfce16973a.zip
Rollback the transaction when one of the autosave associations fails to save. [#3391 state:resolved]
Diffstat (limited to 'activerecord/test/models/ship.rb')
-rw-r--r--activerecord/test/models/ship.rb6
1 files changed, 6 insertions, 0 deletions
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