aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-11-09 05:42:04 -0800
committerJon Leighton <j@jonathanleighton.com>2012-11-09 05:42:04 -0800
commitdbb39e53414294818c056f1db336471dd347d413 (patch)
treeeaa22d1547eeb953a532e53dffe698780dfc42ab /activerecord/test/models
parentedd94cee9af1688dd036fc58fd405adb30a5e0da (diff)
parent710e3710813e52ce71ee2cd5a754cf6462b2ecd3 (diff)
downloadrails-dbb39e53414294818c056f1db336471dd347d413.tar.gz
rails-dbb39e53414294818c056f1db336471dd347d413.tar.bz2
rails-dbb39e53414294818c056f1db336471dd347d413.zip
Merge pull request #8116 from senny/7993_configure_counter_cache_for_has_many
:counter_cache option for to support custom named counter caches
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/topic.rb1
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"