aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/invoice.rb
diff options
context:
space:
mode:
authorBryan Stearns <bryanstearns@gmail.com>2009-09-30 23:17:50 -0700
committerEloy Duran <eloy.de.enige@gmail.com>2010-01-08 21:45:02 +0100
commit1080351437dc43c3ecaa0d494f5ca215f03b1883 (patch)
tree371ebdf25e1ab947ae9ece41b959b9b6dc0f5a2b /activerecord/test/models/invoice.rb
parent802b08da0075bf6426c723957447ed85dc849bba (diff)
downloadrails-1080351437dc43c3ecaa0d494f5ca215f03b1883.tar.gz
rails-1080351437dc43c3ecaa0d494f5ca215f03b1883.tar.bz2
rails-1080351437dc43c3ecaa0d494f5ca215f03b1883.zip
Add failing test that triggers the stack overflow
Diffstat (limited to 'activerecord/test/models/invoice.rb')
-rw-r--r--activerecord/test/models/invoice.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/models/invoice.rb b/activerecord/test/models/invoice.rb
new file mode 100644
index 0000000000..fc6ef0230e
--- /dev/null
+++ b/activerecord/test/models/invoice.rb
@@ -0,0 +1,4 @@
+class Invoice < ActiveRecord::Base
+ has_many :line_items, :autosave => true
+ before_save {|record| record.balance = record.line_items.map(&:amount).sum }
+end