# Query caching, Rails 2.2.2 and frozen attributes

**URL:** <https://www.ruby-forum.com/t/query-caching-rails-2-2-2-and-frozen-attributes/156655>\
**Category:** Rails\
**Created:** [December 31, 2008, 1:27pm UTC](https://www.ruby-forum.com/t/query-caching-rails-2-2-2-and-frozen-attributes/156655 "2008-12-31T13:27:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/838e76/32.png) [@rob](https://www.ruby-forum.com/u/rob)\
**Post date:** [December 31, 2008, 1:27pm UTC](https://www.ruby-forum.com/t/query-caching-rails-2-2-2-and-frozen-attributes/156655/1 "2008-12-31T13:27:20Z")

</div>

Hi there,

I’ve recently upgraded our main application to Rails 2.2.2, but I’ve run  
into an interesting problem. I am trying to update a User object for  
example, but I keep getting the ‘can’t modify frozen hash’ error when  
attempting to call update attributes. It seems that the user object’s  
attributes that I am trying to update are frozen, although I can see no  
reason for this whatsoever. Its only a very basic controller, with show,  
edit, update, etc actions there are no other associated objects. I  
simply do a simple

@user = User.find(params[:id])  
@user.update\_attributes(params[:user])

The @user object is showing as frozen directly after the find. Looking  
through the full trace from my app the only thing I can see that I think  
might cause it is the query cache, although I am unsure of how to really  
to troubleshoot this any further.

Can anyone give me any pointers?

RobL

---

<div class="post-metadata">

**Author:** ![rob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/838e76/32.png) [@rob](https://www.ruby-forum.com/u/rob)\
**Post date:** [December 31, 2008, 3:50pm UTC](https://www.ruby-forum.com/t/query-caching-rails-2-2-2-and-frozen-attributes/156655/2 "2008-12-31T15:50:34Z")

</div>

Quoting Rob L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> simply do a simple
> 
> @user = User.find(params[:id])  
> @user.update\_attributes(params[:user])
> 
> The @user object is showing as frozen directly after the find. Looking  
> through the full trace from my app the only thing I can see that I think  
> might cause it is the query cache, although I am unsure of how to really  
> to troubleshoot this any further.

Do you have any associations with values? For example, has\_many  
:through with  
fields in the join table besides the two IDs? Those will be read only.

HTH,  
Jeffrey
