This project is archived and is in readonly mode.

#3652 ✓stale
Ron Newman

to_xml(:include => :foo) fails for :has_and_belongs_to_many association

Reported by Ron Newman | January 4th, 2010 @ 06:58 PM

If an ActiveRecord model Foo :has_and_belongs_to_many :bars , and you do this:

foo.to_xml(:include => :bar)

the result is a very confusing and uninformative exception:

/Users/ronnewman/.gem/ruby/1.9.1/gems/activerecord-2.3.3/lib/active_record/serializers/xml_serializer.rb:323:in compute_type': undefined methodtype' for nil:NilClass (NoMethodError)

This is best demonstrated by example: run the attached file.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket