aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/belongs_to_association.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/belongs_to_association.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/belongs_to_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/belongs_to_association.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb
index 7c28cbdd07..f05c6be075 100644
--- a/activerecord/lib/active_record/associations/belongs_to_association.rb
+++ b/activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -2,11 +2,11 @@ module ActiveRecord
module Associations
class BelongsToAssociation < AssociationProxy #:nodoc:
def create(attributes = {})
- replace(@reflection.klass.create(attributes))
+ replace(@reflection.create_association(attributes))
end
def build(attributes = {})
- replace(@reflection.klass.new(attributes))
+ replace(@reflection.build_association(attributes))
end
def replace(record)