Forum: Ruby on Rails query caching, Rails 2.2.2 and frozen attributes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rob L. (Guest)
on 2008-12-31 14:27
(Received via mailing list)
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
Jeffrey L. Taylor (Guest)
on 2008-12-31 16:50
(Received via mailing list)
Quoting Rob L. <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
This topic is locked and can not be replied to.