query caching, Rails 2.2.2 and frozen attributes

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

Quoting Rob Lacey <robl@mail.pigdestroyer.co.uk>:

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.

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