diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-19 23:28:44 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-19 23:28:44 +0100 |
commit | 0afd5850f5bba4bd3f1218e27a4a1488c9fdb83e (patch) | |
tree | a5444cdbf2b70d9883ef66a751461b386738eedd /activerecord/lib/active_record/associations | |
parent | c0374999c8656e02db38ab8198af76a411669a53 (diff) | |
download | rails-0afd5850f5bba4bd3f1218e27a4a1488c9fdb83e.tar.gz rails-0afd5850f5bba4bd3f1218e27a4a1488c9fdb83e.tar.bz2 rails-0afd5850f5bba4bd3f1218e27a4a1488c9fdb83e.zip |
Implement proxy_owner, proxy_target and proxy_reflection methods on CollectionProxy with deprecations. Fixes #1148.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/collection_proxy.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index adfc71d435..8415942a1a 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -123,6 +123,30 @@ module ActiveRecord method_missing(:new, *args, &block) end end + + def proxy_owner + ActiveSupport::Deprecation.warn( + "Calling record.#{@association.reflection.name}.proxy_owner is deprecated. Please use " \ + "record.association(:#{@association.reflection.name}).owner instead." + ) + @association.owner + end + + def proxy_target + ActiveSupport::Deprecation.warn( + "Calling record.#{@association.reflection.name}.proxy_target is deprecated. Please use " \ + "record.association(:#{@association.reflection.name}).target instead." + ) + @association.target + end + + def proxy_reflection + ActiveSupport::Deprecation.warn( + "Calling record.#{@association.reflection.name}.proxy_reflection is deprecated. Please use " \ + "record.association(:#{@association.reflection.name}).reflection instead." + ) + @association.reflection + end end end end |