aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-05 07:20:24 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-05 07:20:24 +0000
commit0e92f36d7506ebb7248d046e19299553edad6f53 (patch)
tree4efe2f16a4c57a466154ec12b64241c88344ff60 /activerecord/lib/active_record/associations
parentf1880cac5862172608ff26d1178a31c05b904d77 (diff)
downloadrails-0e92f36d7506ebb7248d046e19299553edad6f53.tar.gz
rails-0e92f36d7506ebb7248d046e19299553edad6f53.tar.bz2
rails-0e92f36d7506ebb7248d046e19299553edad6f53.zip
Added callbacks on push_with_attributes #1594 [Florian Weber]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1698 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index da43e32fb6..39a6a7ed5f 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -82,8 +82,10 @@ module ActiveRecord
def push_with_attributes(record, join_attributes = {})
raise_on_type_mismatch(record)
join_attributes.each { |key, value| record[key.to_s] = value }
+ callback(:before_add, record)
insert_record(record) unless @owner.new_record?
@target << record
+ callback(:after_add, record)
self
end