From 0c272471fe815c121a83d959468b2f1b6f8aaba8 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sun, 26 Dec 2010 19:04:26 +0000 Subject: [PATCH] Remove AssociationProxy#dependent? - it's badly named and only used in one place --- .../lib/active_record/associations/association_proxy.rb | 5 ----- .../lib/active_record/associations/has_one_association.rb | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index f51275d86d..c7b171b41d 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -167,11 +167,6 @@ def send(method, *args) end protected - # Does the association have a :dependent option? - def dependent? - @reflection.options[:dependent] - end - def interpolate_sql(sql, record = nil) @owner.send(:interpolate_sql, sql, record) end diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index fd3827390f..654157d998 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -27,7 +27,7 @@ def replace(obj, dont_save = false) load_target unless @target.nil? || @target == obj - if dependent? && !dont_save + if @reflection.options[:dependent] && !dont_save case @reflection.options[:dependent] when :delete @target.delete if @target.persisted? -- GitLab