I’ve been getting the follow deprecation message a lot since upgrading
to 2.1
/Users/choi/prx/vendor/rails/activerecord/lib/active_record/
associations/association_proxy.rb:184: warning: default `to_a’ will be
obsolete
Digging around, I found out it was caused by this code (abbreviated)
belongs_to :purchased, :polymorphic => true
…
piece = purchased
purchaser_account.licensed_pieces.include?(piece)
A purchaser_account has_many licensed_pieces.
But if I change the code to this, no deprecation warning results:
belongs_to :purchased, :polymorphic => true
…
piece = purchased
piece = Piece.find(piece.id) <---- get the piece afresh apart from the polymorphic association
purchaser_account.licensed_pieces.include?(piece)
I don’t have time at the moment to dig through the Rails code to see
why this is happening, but if anyone can tell me, I’d appreciate it!