Sunday, October 3, 2010

[Rails] Re: Can't modify frozen hash

Luke Cowell wrote:
> Your code freezing on the self.target.save line, made me think you had a
> before_save filter. The Building.find(1008631573) freezing makes me
> think that there's something un-vanilla about your rails install.
>
> Try removing all plugins, gems and any initializers that you have and
> see if the problem goes away. If that doesn't work, create a fresh rails
> project and add your model code and see if the new project has any
> problems.
>
> Does your model have any methods in it that are declared in AR::Base ?
>
> Luke

I ran the tests some more times and I got a new frozen hash error for
some reason which is now on this line. It's the same object: Building:
self.target.condition

RuntimeError: can't modify frozen hash
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/active_record/attribute_methods/write.rb:24:in
`[]='
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/active_record/attribute_methods/write.rb:24:in
`write_attribute'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/active_record/attribute_methods/dirty.rb:61:in
`write_attribute'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/active_record/attribute_methods/write.rb:13:in
`condition='
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/active_record/associations/association_proxy.rb:218:in
`method_missing'
/var/www/rails_app/app/models/activity.rb:153:in `execute'

The model itself is not using any specific gems but has 3 belongs_to's
and and 4 has_many's. Therefore I would kinda need to copy half the
application to the newly created project...

What I also ran into is this error: ActiveRecord::StatementInvalid:
Mysql::LockWaitTimeout: Lock wait timeout exceeded; try restarting
transaction. Got it when I ran the same test but on a completely
different line.

Can I somehow check what froze the hash and locked the other one? I
never had any of these problems in Rails 2.
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate