Daniel Choi
2008-Jun-27 00:54 UTC
odd to_a deprecation message when calling association.include?(polymorphic object)
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! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---