Is there anyway to generate a serialized attribute like this one inside the fixture : knowledge: "--- \n- 1\n- 3\n- 5\n- 7\n" I tried knowledge: <%= [1, 3, 5, 7].to_yaml %> doesn''t not work... so I do it using irb, then copy/paste.. thanks erwin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Does YAML::dump([1,3,5,7]) work ? You will need to require ''yaml'' for it. On Sep 9, 3:10 pm, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote:> Is there anyway to generate a serialized attribute like this one > inside the fixture : > > knowledge: "--- \n- 1\n- 3\n- 5\n- 7\n" > > I tried > knowledge: <%= [1, 3, 5, 7].to_yaml %> > > doesn''t not work... so I do it using irb, then copy/paste.. > > thanks > > erwin--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9 Sep 2008, at 11:10, Erwin wrote:> > Is there anyway to generate a serialized attribute like this one > inside the fixture : > > knowledge: "--- \n- 1\n- 3\n- 5\n- 7\n" > > I tried > knowledge: <%= [1, 3, 5, 7].to_yaml %>The difference between these two is that the second is actually sticking knowledge:--- - 1 - 3 - 5 - 7 In your fixture which is not what you want. knowledge: <%= [1, 3, 5, 7].to_yaml.inspect %> Looks like it might do what you want.> > > doesn''t not work... so I do it using irb, then copy/paste.. > > thanks > > erwin > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---