aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorHongli Lai (Phusion) <hongli@phusion.nl>2008-09-06 19:43:14 +0200
committerJeremy Kemper <jeremy@bitsweat.net>2008-09-09 13:13:12 -0700
commit1398db0128be7ae01700712eafc95be5de430f7c (patch)
treececf4f2ef0fd7c2747826fd22c56ba8f596ed1c4 /activerecord/lib/active_record/associations.rb
parent16929404417205792165153958ce5effa0b54645 (diff)
downloadrails-1398db0128be7ae01700712eafc95be5de430f7c.tar.gz
rails-1398db0128be7ae01700712eafc95be5de430f7c.tar.bz2
rails-1398db0128be7ae01700712eafc95be5de430f7c.zip
Add special AssociationReflection methods for creating association objects, and modify the code base to use those methods instead of creating association objects directly. This allows plugins to hook into association object creation behavior.
[#986 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 990eda3ee3..f9a728d49e 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1266,7 +1266,7 @@ module ActiveRecord
association = association_proxy_class.new(self, reflection)
end
- new_value = reflection.klass.new(new_value) if reflection.options[:accessible] && new_value.is_a?(Hash)
+ new_value = reflection.build_association(new_value) if reflection.options[:accessible] && new_value.is_a?(Hash)
if association_proxy_class == HasOneThroughAssociation
association.create_through_record(new_value)