diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-11-04 17:09:25 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2012-11-04 17:09:25 +0100 |
commit | 710e3710813e52ce71ee2cd5a754cf6462b2ecd3 (patch) | |
tree | 4622f9356af6e19830920c2f875f122194655deb /activerecord/test/models | |
parent | f786469f54332458ed60a1bbefec3125afe5f64b (diff) | |
download | rails-710e3710813e52ce71ee2cd5a754cf6462b2ecd3.tar.gz rails-710e3710813e52ce71ee2cd5a754cf6462b2ecd3.tar.bz2 rails-710e3710813e52ce71ee2cd5a754cf6462b2ecd3.zip |
:counter_cache option for to support custom named counter caches. Closes #7993
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/topic.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 4b27c16681..ab31d85e46 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -33,6 +33,7 @@ class Topic < ActiveRecord::Base end has_many :replies, :dependent => :destroy, :foreign_key => "parent_id" + has_many :approved_replies, -> { approved }, class_name: 'Reply', foreign_key: "parent_id", counter_cache: 'replies_count' has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title" has_many :unique_replies, :dependent => :destroy, :foreign_key => "parent_id" |