Singular associations no longer use a proxy, so no need to check for the proxy type on assignment.

This commit is contained in:
Jon Leighton
2011-02-20 20:34:06 +00:00
committed by Aaron Patterson
parent 1d85a73ceb
commit 73ff0076b3
3 changed files with 2 additions and 8 deletions

View File

@@ -3,7 +3,7 @@ module ActiveRecord
module Associations
class BelongsToAssociation < SingularAssociation #:nodoc:
def replace(record)
record = check_record(record)
raise_on_type_mismatch(record) if record
update_counters(record)
replace_keys(record)

View File

@@ -3,7 +3,7 @@ module ActiveRecord
module Associations
class HasOneAssociation < SingularAssociation #:nodoc:
def replace(record, save = true)
record = check_record(record)
raise_on_type_mismatch(record) if record
load_target
reflection.klass.transaction do

View File

@@ -28,12 +28,6 @@ module ActiveRecord
replace(record)
end
def check_record(record)
record = record.target if Association === record
raise_on_type_mismatch(record) if record
record
end
def new_record(method, attributes)
attributes = scoped.scope_for_create.merge(attributes || {})
record = reflection.send("#{method}_association", attributes)