Skip to content
This repository
Browse code

Singular associations no longer use a proxy, so no need to check for …

…the proxy type on assignment.
  • Loading branch information...
commit 73ff0076b37316af685bc411bd11a7908d7794f6 1 parent 1d85a73
Jon Leighton authored February 20, 2011 tenderlove committed February 21, 2011
2  activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -3,7 +3,7 @@ module ActiveRecord
3 3
   module Associations
4 4
     class BelongsToAssociation < SingularAssociation #:nodoc:
5 5
       def replace(record)
6  
-        record = check_record(record)
  6
+        raise_on_type_mismatch(record) if record
7 7
 
8 8
         update_counters(record)
9 9
         replace_keys(record)
2  activerecord/lib/active_record/associations/has_one_association.rb
@@ -3,7 +3,7 @@ module ActiveRecord
3 3
   module Associations
4 4
     class HasOneAssociation < SingularAssociation #:nodoc:
5 5
       def replace(record, save = true)
6  
-        record = check_record(record)
  6
+        raise_on_type_mismatch(record) if record
7 7
         load_target
8 8
 
9 9
         reflection.klass.transaction do
6  activerecord/lib/active_record/associations/singular_association.rb
@@ -28,12 +28,6 @@ def set_new_record(record)
28 28
           replace(record)
29 29
         end
30 30
 
31  
-        def check_record(record)
32  
-          record = record.target if Association === record
33  
-          raise_on_type_mismatch(record) if record
34  
-          record
35  
-        end
36  
-
37 31
         def new_record(method, attributes)
38 32
           attributes = scoped.scope_for_create.merge(attributes || {})
39 33
           record = reflection.send("#{method}_association", attributes)

0 notes on commit 73ff007

Please sign in to comment.
Something went wrong with that request. Please try again.