SP
2007-May-17 00:06 UTC
Namespaced model valid #to_xml support in ActiveRecord, ActiveSupport and ActiveResource
Hi, Attached are links to two patches I submitted via the RoR Trac system a week or so ago: http://dev.rubyonrails.org/ticket/8305 http://dev.rubyonrails.org/ticket/8308 I refrained from creating a new Trac ticket for ARes, which will be affected if both of these patches are accepted by Core. There are a couple of workarounds for this issue, but it would be nice for AR, AS and ARes to output valid XML and resolve to namespaced models correctly from XML respectively. Currently #to_xml on ActiveRecord::Base and Array creates invalid XML output for namespaced models. For one of the workarounds (which unfortunately seems to break RSpec partial mocks of models) see one of my blog postings at: http://snakesgemscoffee.blogspot.com/2007/05/activerecordbasetoxml-woes.html Comments are appreciated and I am open to creating a RubyGem or Rails Plugin to fix this issue if it seems that the Core team do not want to fix this in Rails any time soon. Thanks. SP --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2007-May-23 23:57 UTC
Re: Namespaced model valid #to_xml support in ActiveRecord, ActiveSupport and ActiveResource
> http://dev.rubyonrails.org/ticket/8305 > http://dev.rubyonrails.org/ticket/8308An XML namespace has to be declared to be valid xml, so the patches submitted seem to leave us in the same situation where .to_xml will produce invalid xml. So given Module::Model, the only options I can think of are <module_model> or <model>? Which is better or worse for your particular situation? -- 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
ara.t.howard
2007-May-24 01:16 UTC
Re: Namespaced model valid #to_xml support in ActiveRecord, ActiveSupport and ActiveResource
On May 23, 2007, at 5:57 PM, Michael Koziarski wrote:> >> http://dev.rubyonrails.org/ticket/8305 >> http://dev.rubyonrails.org/ticket/8308 > > An XML namespace has to be declared to be valid xml, so the patches > submitted seem to leave us in the same situation where .to_xml will > produce invalid xml. > > So given Module::Model, the only options I can think of are > <module_model> or <model>? Which is better or worse for your > particular situation? >what about ''<module-model>'' since ''-'' cannot possible be part of a ruby class/module name? it allows for <module-foo_bar> etc. -a -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2007-May-24 07:01 UTC
Re: Namespaced model valid #to_xml support in ActiveRecord, ActiveSupport and ActiveResource
That sounds like a reasonable option. Perhaps something else worth considering is that overriding the root element for a given model class is a little hard. Perhaps that''s a sign we should be refactoring the serialization a little? On 5/24/07, ara.t.howard <ara.t.howard@gmail.com> wrote:> > > On May 23, 2007, at 5:57 PM, Michael Koziarski wrote: > > > > >> http://dev.rubyonrails.org/ticket/8305 > >> http://dev.rubyonrails.org/ticket/8308 > > > > An XML namespace has to be declared to be valid xml, so the patches > > submitted seem to leave us in the same situation where .to_xml will > > produce invalid xml. > > > > So given Module::Model, the only options I can think of are > > <module_model> or <model>? Which is better or worse for your > > particular situation? > > > > what about ''<module-model>'' since ''-'' cannot possible be part of a > ruby class/module name? it allows for > > <module-foo_bar> > etc. > > -a > -- > we can deny everything, except that we have the possibility of being > better. simply reflect on that. > h.h. the 14th dalai lama > > > > > > >-- 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Josh Susser
2007-May-24 16:57 UTC
Re: Namespaced model valid #to_xml support in ActiveRecord, ActiveSupport and ActiveResource
Refactoring serialization +1 I''m also looking at a refactoring that will make it easy to have the same flexibility in to_json as in to_xml. I probably won''t get to it for a week or two at this rate, but if someone beats me to it I won''t mind too much... --josh On May 24, 2007, at 12:01 AM, Michael Koziarski wrote:> > That sounds like a reasonable option. Perhaps something else worth > considering is that overriding the root element for a given model > class is a little hard. Perhaps that''s a sign we should be refactoring > the serialization a little? > > On 5/24/07, ara.t.howard <ara.t.howard@gmail.com> wrote: >> >> >> On May 23, 2007, at 5:57 PM, Michael Koziarski wrote: >> >>> >>>> http://dev.rubyonrails.org/ticket/8305 >>>> http://dev.rubyonrails.org/ticket/8308 >>> >>> An XML namespace has to be declared to be valid xml, so the patches >>> submitted seem to leave us in the same situation where .to_xml will >>> produce invalid xml. >>> >>> So given Module::Model, the only options I can think of are >>> <module_model> or <model>? Which is better or worse for your >>> particular situation? >>> >> >> what about ''<module-model>'' since ''-'' cannot possible be part of a >> ruby class/module name? it allows for >> >> <module-foo_bar> >> etc. >> >> -a >> -- >> we can deny everything, except that we have the possibility of being >> better. simply reflect on that. >> h.h. the 14th dalai lama >> >> >> >> >>> >> > > > -- > Cheers > > Koz > > >-- Josh Susser http://blog.hasmanythrough.com --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---