Rémi Gagnon
2009-Jan-21 14:56 UTC
AR to_xml problem with associations, Builder::XmlMarkup#to_a
When I do a to_xml(with a block) on an association of a model I got a Builder::XmlMarkup#to_ary should return Array Example that does not work. @intervenant = Intervenant.find(params[:id]) output = @intervenant.to_xml( :skip_types => false, :dasherize => false) do |xml| @intervenant.individu.to_xml( :builder => xml, :skip_instruct => true, :skip_types => false, :dasherize => false) do |xml_individu| #do special stuff at this level..... end end Ex that do work but seems little bit dirty: @intervenant = Intervenant.find(params[:id]) @individu = Individu.find(params[:id]) output = @intervenant.to_xml( :skip_types => false, :dasherize => false) do |xml| @individu.to_xml( :builder => xml, :skip_instruct => true, :skip_types => false, :dasherize => false) do |xml_individu| #do special stuff at this level..... end end Any idea? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rémi Gagnon
2009-Jan-21 15:20 UTC
Re: AR to_xml problem with associations, Builder::XmlMarkup#to_a
Just to be more precise on my issue, it seems to happen only on "has_one" relationship. The "has_many" works like it should. Rémi Gagnon wrote:> When I do a to_xml(with a block) on an association of a model I got a > > Builder::XmlMarkup#to_ary should return Array >..... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---