Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
@jonleighton jonleighton authored tenderlove committed
View
2  activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -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
2  activerecord/lib/active_record/associations/has_one_association.rb
@@ -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
6 activerecord/lib/active_record/associations/singular_association.rb
@@ -28,12 +28,6 @@ def set_new_record(record)
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)
Please sign in to comment.
Something went wrong with that request. Please try again.