# Catching frozen hashes

**URL:** <https://www.ruby-forum.com/t/catching-frozen-hashes/92314>\
**Category:** Rails\
**Created:** [April 18, 2007, 6:51am UTC](https://www.ruby-forum.com/t/catching-frozen-hashes/92314 "2007-04-18T06:51:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![clemrock](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c57346/32.png) [@clemrock](https://www.ruby-forum.com/u/clemrock)\
**Post date:** [April 18, 2007, 6:51am UTC](https://www.ruby-forum.com/t/catching-frozen-hashes/92314/1 "2007-04-18T06:51:12Z")

</div>

Hello

I have been wrestling w/ the frozen hash problem in a script and I’m  
trying to catch this at the source where it crashes the program in  
flames. Unfortunately, when I look at the errors, the failure is way  
up in the active record ancestery chain.

Here’s the first entries in the error output:

```
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1877:in

```

`[]=' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1877:in`unserialize\_attribute’  
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/base.rb:1803:in  
`read_attribute' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1489:in`[]’

Also, I know you can test to see if a hash is frozen by using the  
frozen? method.

I just don’t know where test and rescue this exception.

Thanks for any help!
