aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb
index 8245234854..17b8cc6446 100644
--- a/activerecord/lib/active_record/associations/association_proxy.rb
+++ b/activerecord/lib/active_record/associations/association_proxy.rb
@@ -17,13 +17,20 @@ module ActiveRecord
reset
end
- def reload
- reset
+ def respond_to?(symbol, include_priv = false)
+ proxy_respond_to?(symbol, include_priv) || (load_target && @target.respond_to?(symbol, include_priv))
+ end
+
+ # Explicitly proxy === because the instance method removal above
+ # doesn't catch it.
+ def ===(other)
load_target
+ other === @target
end
- def respond_to?(symbol, include_priv = false)
- proxy_respond_to?(symbol, include_priv) || (load_target && @target.respond_to?(symbol, include_priv))
+ def reload
+ reset
+ load_target
end
def loaded?
@@ -98,4 +105,4 @@ module ActiveRecord
end
end
end
-end \ No newline at end of file
+end