aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/post.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-12-17 20:54:50 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-20 13:56:04 -0800
commit834e5336a5d8a8250251e756385e39ebfb4917c3 (patch)
tree76adf636cd2fe00e272ab77d98fca75f814d0174 /activerecord/test/models/post.rb
parent57b90098930a52fa160f9b1aed2dcea0f557d670 (diff)
downloadrails-834e5336a5d8a8250251e756385e39ebfb4917c3.tar.gz
rails-834e5336a5d8a8250251e756385e39ebfb4917c3.tar.bz2
rails-834e5336a5d8a8250251e756385e39ebfb4917c3.zip
has_many associations with :dependent => :delete_all should update the counter cache when deleting records
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r--activerecord/test/models/post.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 34ea49f731..0083560ebe 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -59,6 +59,8 @@ class Post < ActiveRecord::Base
end
end
+ has_many :taggings_with_delete_all, :class_name => 'Tagging', :as => :taggable, :dependent => :delete_all
+
has_many :misc_tags, :through => :taggings, :source => :tag, :conditions => "tags.name = 'Misc'"
has_many :funky_tags, :through => :taggings, :source => :tag
has_many :super_tags, :through => :taggings