Permalink
Browse files

Update deprecation messages to point out the availability of proxy_as…

…sociation. Fixes #1148.
  • Loading branch information...
1 parent 7bf9b9a commit e13e25dda58c9c936678e4b0a122c51d0100f589 @jonleighton jonleighton committed Jul 27, 2011
Showing with 9 additions and 6 deletions.
  1. +9 −6 activerecord/lib/active_record/associations/collection_proxy.rb
@@ -132,25 +132,28 @@ def reload
def proxy_owner
ActiveSupport::Deprecation.warn(
"Calling record.#{@association.reflection.name}.proxy_owner is deprecated. Please use " \
- "record.association(:#{@association.reflection.name}).owner instead."
+ "record.association(:#{@association.reflection.name}).owner instead. Or, from an " \
+ "association extension you can access proxy_association.owner."
)
- @association.owner
+ proxy_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."
+ "record.association(:#{@association.reflection.name}).target instead. Or, from an " \
+ "association extension you can access proxy_association.target."
)
- @association.target
+ proxy_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."
+ "record.association(:#{@association.reflection.name}).reflection instead. Or, from an " \
+ "association extension you can access proxy_association.reflection."
)
- @association.reflection
+ proxy_association.reflection
end
end
end

0 comments on commit e13e25d

Please sign in to comment.