aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-02-05 13:13:49 +0000
committerJon Leighton <j@jonathanleighton.com>2011-02-07 23:35:05 +0000
commit52f09eac5b3d297021ef726e04ec19f6011cb302 (patch)
treec2b15313ce7bc00ade263d2e9030721c32381f3b /activerecord/test/models
parent05bcb8cecc8573f28ad080839233b4bb9ace07be (diff)
downloadrails-52f09eac5b3d297021ef726e04ec19f6011cb302.tar.gz
rails-52f09eac5b3d297021ef726e04ec19f6011cb302.tar.bz2
rails-52f09eac5b3d297021ef726e04ec19f6011cb302.zip
Correctly update counter caches on deletion for has_many :through [#2824 state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/post.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 1c95d30d6b..fd8cd2244a 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -39,6 +39,7 @@ class Post < ActiveRecord::Base
has_many :author_favorites, :through => :author
has_many :author_categorizations, :through => :author, :source => :categorizations
+ has_many :author_addresses, :through => :author
has_one :very_special_comment
has_one :very_special_comment_with_post, :class_name => "VerySpecialComment", :include => :post
@@ -57,6 +58,10 @@ class Post < ActiveRecord::Base
end
has_many :taggings_with_delete_all, :class_name => 'Tagging', :as => :taggable, :dependent => :delete_all
+ has_many :taggings_with_destroy, :class_name => 'Tagging', :as => :taggable, :dependent => :destroy
+
+ has_many :tags_with_destroy, :through => :taggings, :source => :tag, :dependent => :destroy
+ has_many :tags_with_nullify, :through => :taggings, :source => :tag, :dependent => :nullify
has_many :misc_tags, :through => :taggings, :source => :tag, :conditions => "tags.name = 'Misc'"
has_many :funky_tags, :through => :taggings, :source => :tag