aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/builder/has_many.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-08-10 16:23:02 +0100
committerJon Leighton <j@jonathanleighton.com>2012-08-10 17:45:07 +0100
commit825c05d491205840438d3ec346bd3c12e5291a93 (patch)
tree163bf5a38ed0f15fe43dfe386c844161422d8b07 /activerecord/lib/active_record/associations/builder/has_many.rb
parentea8181b65637af65db5bb834f1c86df57969516e (diff)
downloadrails-825c05d491205840438d3ec346bd3c12e5291a93.tar.gz
rails-825c05d491205840438d3ec346bd3c12e5291a93.tar.bz2
rails-825c05d491205840438d3ec346bd3c12e5291a93.zip
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.
Diffstat (limited to 'activerecord/lib/active_record/associations/builder/has_many.rb')
-rw-r--r--activerecord/lib/active_record/associations/builder/has_many.rb26
1 files changed, 12 insertions, 14 deletions
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