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
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
Does YAML::dump([1,3,5,7]) work ? You will need to require 'yaml' for it.
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.