# Noob question - assigning hash to flash error

**URL:** <https://www.ruby-forum.com/t/noob-question-assigning-hash-to-flash-error/111577>\
**Category:** Rails\
**Created:** [August 8, 2007, 7:22pm UTC](https://www.ruby-forum.com/t/noob-question-assigning-hash-to-flash-error/111577 "2007-08-08T19:22:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![donna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7993a0/32.png) [@donna](https://www.ruby-forum.com/u/donna)\
**Post date:** [August 8, 2007, 7:22pm UTC](https://www.ruby-forum.com/t/noob-question-assigning-hash-to-flash-error/111577/1 "2007-08-08T19:22:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![donna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7993a0/32.png) [@donna](https://www.ruby-forum.com/u/donna)\
**Post date:** [August 8, 2007, 7:41pm UTC](https://www.ruby-forum.com/t/noob-question-assigning-hash-to-flash-error/111577/2 "2007-08-08T19:41:54Z")

</div>

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 🙂
