aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-08-01 11:36:39 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-08-01 11:43:52 -0700
commit8ea64bd0fce854a4bb85bf67c983d30358c8cd39 (patch)
treeda306457bd3cd036db76b24c59e81a9b8cfeeb9b
parentfaf4a39cf6d9b25727efde2550dfbbf79dd5925a (diff)
downloadrails-8ea64bd0fce854a4bb85bf67c983d30358c8cd39.tar.gz
rails-8ea64bd0fce854a4bb85bf67c983d30358c8cd39.tar.bz2
rails-8ea64bd0fce854a4bb85bf67c983d30358c8cd39.zip
remove more mutations from the `build` method
-rw-r--r--activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
index 64ee24c7c6..55ec3bf4f1 100644
--- a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
+++ b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
@@ -8,13 +8,8 @@ module ActiveRecord::Associations::Builder
super + [:join_table, :association_foreign_key]
end
- def build
- reflection = super
- define_destroy_hook
- reflection
- end
-
- def define_destroy_hook
+ def define_callbacks(model, reflection)
+ super
name = self.name
model.send(:include, Module.new {
class_eval <<-RUBY, __FILE__, __LINE__ + 1