ActiveRecord proxy_owner is now deprecated and the explanation here is very vague on how to change it, so I'm not sure how to use it my case: http://apidock.com/rails/ActiveRecord/Associations/AssociationProxy
Here is what I'm trying to do:
class Library < ActiveRecord::Base
has_many :books do
def some_method
proxy_owner.author
end
end
end
I get a warning when I run this code that proxy_owner is deprecated:
DEPRECATION WARNING: Calling record.books.proxy_owner is deprecated. Please use record.association(:books).owner instead.
I can replace proxy_owner.author with:
@associaton.owner.author
This works; however, it seems dangerous. Am I missing something here?