aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-10-10 17:02:47 +0200
committerMichael Koziarski <michael@koziarski.com>2008-10-10 17:04:46 +0200
commitcb45ee344d5ec6974b78dc593e4eaef2101e3d42 (patch)
treeb26c2b88e8630ce085ed8f3186e6aa37b56f82f0 /activerecord/lib/active_record/associations.rb
parent4c05055487e149bfa4152c1b42f3519671ca22ac (diff)
downloadrails-cb45ee344d5ec6974b78dc593e4eaef2101e3d42.tar.gz
rails-cb45ee344d5ec6974b78dc593e4eaef2101e3d42.tar.bz2
rails-cb45ee344d5ec6974b78dc593e4eaef2101e3d42.zip
Remove the functionality introduce in 28d3390
There are several situations it doesn't cater for, and the inconsistency isn't worth blocking 2.2.
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb13
1 files changed, 1 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 7c0d0cb689..ad093d83d4 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1235,7 +1235,7 @@ module ActiveRecord
association = instance_variable_get(ivar) if instance_variable_defined?(ivar)
- if association.nil? || !association.loaded? || force_reload
+ if association.nil? || force_reload
association = association_proxy_class.new(self, reflection)
retval = association.reload
if retval.nil? and association_proxy_class == BelongsToAssociation
@@ -1269,17 +1269,6 @@ module ActiveRecord
end
end
- if association_proxy_class == BelongsToAssociation
- define_method("#{reflection.primary_key_name}=") do |target_id|
- if instance_variable_defined?(ivar)
- if association = instance_variable_get(ivar)
- association.reset
- end
- end
- write_attribute(reflection.primary_key_name, target_id)
- end
- end
-
define_method("set_#{reflection.name}_target") do |target|
return if target.nil? and association_proxy_class == BelongsToAssociation
association = association_proxy_class.new(self, reflection)