Noob question - assigning hash to flash error

In my controller, I have this simple code:

hashThing = Hash.new{ |hash, key| hash[key] = [] }; # this declares a
hash with array values
hashThing[‘something’] << “value1” << “value”;
flash[:quick_store_hash] = hashThing;

When I run it, I get a TypeError in Controller#action. The error message
is: “can’t dump hash with default proc” and that makes no sense to me.
I’m new to ruby/rails, and would appreciate any help.

Thanks!
donna

Donna Massimo wrote:

In my controller, I have this simple code:

hashThing = Hash.new{ |hash, key| hash[key] = [] }; # this declares a
hash with array values
hashThing[‘something’] << “value1” << “value”;
flash[:quick_store_hash] = hashThing;

When I run it, I get a TypeError in Controller#action. The error message
is: “can’t dump hash with default proc” and that makes no sense to me.
I’m new to ruby/rails, and would appreciate any help.

Thanks!
donna

I think I have it figured out. If I do this:

hashThing = Hash.new();
hashThing[‘something’] = Array.new();
hashThing[‘something’] << “value1” << “value”;

flash[:quick_store_hash] = hashThing;

…all is well. Hope this helps somebody else out there :slight_smile: