From 47d252f9928568620844edce2161acd457c352c0 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 7 Mar 2010 21:53:21 -0300 Subject: Fix associations to call :destroy or :delete based on the right :dependent option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/test/models/author.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'activerecord/test/models/author.rb') diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 7cbc6e803f..025f6207f8 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -35,7 +35,7 @@ class Author < ActiveRecord::Base has_many :ordered_uniq_comments, :through => :posts, :source => :comments, :uniq => true, :order => 'comments.id' has_many :ordered_uniq_comments_desc, :through => :posts, :source => :comments, :uniq => true, :order => 'comments.id DESC' has_many :readonly_comments, :through => :posts, :source => :comments, :readonly => true - + has_many :special_posts has_many :special_post_comments, :through => :special_posts, :source => :comments @@ -130,14 +130,11 @@ class AuthorAddress < ActiveRecord::Base has_one :author def self.destroyed_author_address_ids - @destroyed_author_address_ids ||= Hash.new { |h,k| h[k] = [] } + @destroyed_author_address_ids ||= [] end before_destroy do |author_address| - if author_address.author - AuthorAddress.destroyed_author_address_ids[author_address.author.id] << author_address.id - end - true + AuthorAddress.destroyed_author_address_ids << author_address.id end end -- cgit v1.2.3