diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2013-03-20 15:51:30 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2013-03-20 15:51:30 -0700 |
commit | 70d0537d5550958d7e006787de869ce9046101fc (patch) | |
tree | 121d61ad1bc38b739f0434d4f808c8dd09ef8d9c /activerecord/test/models | |
parent | 066907d1cb3e7e390287dff9c324a4091d76a97b (diff) | |
parent | 66679c8ecd9e916cbd96745b853603bc2fed7639 (diff) | |
download | rails-70d0537d5550958d7e006787de869ce9046101fc.tar.gz rails-70d0537d5550958d7e006787de869ce9046101fc.tar.bz2 rails-70d0537d5550958d7e006787de869ce9046101fc.zip |
Merge pull request #7706 from iangreenleaf/multiple_counter_caches
Update other counter caches on destroy
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/dog.rb | 5 | ||||
-rw-r--r-- | activerecord/test/models/dog_lover.rb | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/test/models/dog.rb b/activerecord/test/models/dog.rb index 72b7d33a86..b02b8447b8 100644 --- a/activerecord/test/models/dog.rb +++ b/activerecord/test/models/dog.rb @@ -1,4 +1,5 @@ class Dog < ActiveRecord::Base - belongs_to :breeder, :class_name => "DogLover", :counter_cache => :bred_dogs_count - belongs_to :trainer, :class_name => "DogLover", :counter_cache => :trained_dogs_count + belongs_to :breeder, class_name: "DogLover", counter_cache: :bred_dogs_count + belongs_to :trainer, class_name: "DogLover", counter_cache: :trained_dogs_count + belongs_to :doglover, foreign_key: :dog_lover_id, class_name: "DogLover", counter_cache: true end diff --git a/activerecord/test/models/dog_lover.rb b/activerecord/test/models/dog_lover.rb index a33dc575c5..2c5be94aea 100644 --- a/activerecord/test/models/dog_lover.rb +++ b/activerecord/test/models/dog_lover.rb @@ -1,4 +1,5 @@ class DogLover < ActiveRecord::Base - has_many :trained_dogs, :class_name => "Dog", :foreign_key => :trainer_id - has_many :bred_dogs, :class_name => "Dog", :foreign_key => :breeder_id + has_many :trained_dogs, class_name: "Dog", foreign_key: :trainer_id, dependent: :destroy + has_many :bred_dogs, class_name: "Dog", foreign_key: :breeder_id + has_many :dogs end |