Hi, i m trying to do some kind of database dump using .to_xml and after i try to fill my database back (well an other) with the content of the xml. Right now i m doing that : @xml = Video.find(:all).to_xml(:include=>[:vlogiciels]) it does produce : <videos> <video> <mycolumns> ..... <vlogiciels> <logiciel> <my vlogiciels columns> ... </logiciel> </vlogiciels> ..... </video> </videos> Then i try to do : Video.new(Hash.form_xml(@xml)) and then i ve got this error : undefined method `videos='' for #<Video: 0x3f6e82c> I guess the problem is caused by the <videos> tag into the xml... ? Anyway i don t know how to solve my problem, if someone could give me an hand, i googled since 2hours without reel success :(... Maybe it s a tricky question, but i m stuck :( Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
no one does have any clue for me ? thanks On 23 mai, 18:16, Differenthink <guillaume.mont...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > i m trying to do some kind of database dump using .to_xml > and after i try to fill my database back (well an other) with the > content of the xml. > > Right now i m doing that : > > @xml = Video.find(:all).to_xml(:include=>[:vlogiciels]) > > it does produce : > > <videos> > <video> > <mycolumns> > ..... > <vlogiciels> > <logiciel> > <my vlogiciels columns> > ... > </logiciel> > </vlogiciels> > ..... > </video> > </videos> > > Then i try to do : > > Video.new(Hash.form_xml(@xml)) > > and then i ve got this error : undefined method `videos='' for #<Video: > 0x3f6e82c> > > I guess the problem is caused by the <videos> tag into the xml... ? > Anyway i don t know how to solve my problem, if someone could give me > an hand, i googled since 2hours without reel success :(... > > Maybe it s a tricky question, but i m stuck :( > > Thanks--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Differenthink wrote:> > @xml = Video.find(:all).to_xml(:include=>[:vlogiciels]) > > > Then i try to do : > > Video.new(Hash.form_xml(@xml)) >I maybe can help a little. Instead of find(:all .., try find(:first .... I understand that that is now what you want eventually. But, I think your problem is that Video.new is going to return one Video but your @xml is an array of Videos. -- 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 -~----------~----~----~----~------~----~------~--~---
Thanks for your post. I did what you told me, i ve got an : NoMethodError: undefined method ''video='' for #<video:XXXX> it seems that it didn t like the first tag <video>... On 24 mai, 21:53, Perry Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Differenthink wrote: > > > @xml = Video.find(:all).to_xml(:include=>[:vlogiciels]) > > > Then i try to do : > > > Video.new(Hash.form_xml(@xml)) > > I maybe can help a little. Instead of find(:all .., try find(:first > .... I understand that that is now what you want eventually. But, I > think your problem is that Video.new is going to return one Video but > your @xml is an array of Videos. > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---