i''ve got a project which i need to create some dynamic forms. each one will be different so it seems almost impossible to keep a 1 to 1 relationship between each form field and a corresponding column in the database. i''ve heard that YAML is a lot faster than XML. would this be something i can use or is there something else that anyone would recommend for something like this? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Aye. class MyThingy < AR::Base serialize :form_data end The form_data field will now be automatically saved as YAML text on save/create, and pulled back out into valid Ruby objects. For example: MyThingy.create :form_data => {:one => 1, :two => 2} becomes one: 1 two: 2 Jason On 8/2/07, Josh <jjkiesch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > i''ve got a project which i need to create some dynamic forms. each one > will be different so it seems almost impossible to keep a 1 to 1 > relationship between each form field and a corresponding column in the > database. > > i''ve heard that YAML is a lot faster than XML. would this be something > i can use or is there something else that anyone would recommend for > something like this? > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
oh man, that''s perfect! i looked up serialize in the api and it says that it will deserialize it when it is loaded. does that mean that i''ll also be able to do this? my_thingy.form_data.one my_thingy.form_data.two On Aug 2, 1:36 pm, "Jason Roelofs" <jameskil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Aye. > > class MyThingy < AR::Base > serialize :form_data > end > > The form_data field will now be automatically saved as YAML text on > save/create, and pulled back out into valid Ruby objects. > > For example: > > MyThingy.create :form_data => {:one => 1, :two => 2} > > becomes > > one: 1 > two: 2 > > Jason > > On 8/2/07, Josh <jjkie...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > i''ve got a project which i need to create some dynamic forms. each one > > will be different so it seems almost impossible to keep a 1 to 1 > > relationship between each form field and a corresponding column in the > > database. > > > i''ve heard that YAML is a lot faster than XML. would this be something > > i can use or is there something else that anyone would recommend for > > something like this?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Josh wrote:> oh man, that''s perfect! i looked up serialize in the api and it says > that it will deserialize it when it is loaded. does that mean that > i''ll also be able to do this? > > my_thingy.form_data.one > my_thingy.form_data.twoNo, it would be my_thingy.form_data[:one], but that''s close enough. -- Cheers, - Jacob Atzen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---