I defined in my model :
…
serialize :unavailables
…
which is set like this (Hash : “year” => 2-dimensional Array)
{“2008” => Array.new(13).map!{ Array.new(32, 1)} }
In my fixture I need to initiliaze this field with the following
hash :
{“2008” => Array.new(4).map!{ Array.new(32, 1)} + Array.new(1).map!
{ [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] } + Array.new(8).map!
{ Array.new(32, 1)} }
I tried to write :
<%= Hash.new({“2008” => Array.new(10).map!{ Array.new(32, 1)} +
Array.new(1).map!{ [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] } +
Array.new(2).map!{ Array.new(32, 1)} }) %>
but it gives me a full string :
myobject.unavailables
“200811111111111111111111111111111111111111111111111…”
I also tried :
<%= Hash.new({“2008” => Array.new(10).map!{ Array.new(32, 1)} +
Array.new(1).map!{ [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] } +
Array.new(2).map!{ Array.new(32, 1)} }).to_yaml %>
but it gives me an empty hash :
myobject.unavailables
{}
any clue ?
thanks