From 825c05d491205840438d3ec346bd3c12e5291a93 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 10 Aug 2012 16:23:02 +0100 Subject: Unprivatise all the things Well, not all of them, but some of them. I don't think there's much reason for these methods to be private. --- .../active_record/associations/builder/has_many.rb | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'activerecord/lib/active_record/associations/builder/has_many.rb') diff --git a/activerecord/lib/active_record/associations/builder/has_many.rb b/activerecord/lib/active_record/associations/builder/has_many.rb index 309612f41c..a23948c985 100644 --- a/activerecord/lib/active_record/associations/builder/has_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_many.rb @@ -15,23 +15,21 @@ module ActiveRecord::Associations::Builder reflection end - private + def configure_dependency + if dependent = options[:dependent] + validate_dependent_option [:destroy, :delete_all, :nullify, :restrict, :restrict_with_error, :restrict_with_exception] - def configure_dependency - if dependent = options[:dependent] - validate_dependent_option [:destroy, :delete_all, :nullify, :restrict, :restrict_with_error, :restrict_with_exception] - - name = self.name - mixin.redefine_method(dependency_method_name) do - association(name).handle_dependency - end - - model.before_destroy dependency_method_name + name = self.name + mixin.redefine_method(dependency_method_name) do + association(name).handle_dependency end - end - def dependency_method_name - "has_many_dependent_for_#{name}" + model.before_destroy dependency_method_name end + end + + def dependency_method_name + "has_many_dependent_for_#{name}" + end end end -- cgit v1.2.3