> I'm not sure if this would be considered a defect or not, so I wanted > to post here before adding a report to Trac. Perhaps someone here is > aware of something I'm not. > > Let's say I have the following model classes defined: > > ### BEGIN ### > class Foo < ActiveRecord::Base > has_many :bars > > def some_method > "I am some_method" > end > end > > class Bar < ActiveRecord::Base > belongs_to :foo > end > ### END ### > > If I try to run "Foo.find( 1 ).to_xml( :include => [ :bars ], :methods > => [ :some_method ] )" there is a problem, because the options hash > passed to Foo#to_xml is passed down to Bar#to_xml when it serializes > the associated objects. In general, that's probably what you want -- > the problem is that Bar#some_method is not defined, and so you get a > NoMethodError when the serialization tries to call #some_method on the > Bar instances.
This definitely is a bug, please open a ticket and attach your proposed fix. While .to_xml isn't designed to be the be-all-and-end-all solution for generating xml, this is well within reason. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
