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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---