#870 ✓resolved
Shane Hanna

Collection attempts to modify frozen Resource.

Reported by Shane Hanna | May 29th, 2009 @ 02:31 AM

Calling methods (.size, .destroy etc.) on a Collection of frozen (no primary key so readonly) objects causes a runtime error because it can't modify the fozen object(s).

Stacktrace from the error:

RuntimeError: can't modify frozen object
    /opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:1097:in `relate_resource'
    /opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:1118:in `block in relate_resources'
    /opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:1118:in `each'
    /opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:1118:in `relate_resources'
    /opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:499:in `concat'
    /opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:989:in `lazy_load'
    /opt/local/lib/ruby/gems/1.9.1/gems/extlib-0.9.13/lib/extlib/lazy_array.rb:459:in `size'

Stacktrace from an overloaded Model#freeze:

/opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/model.rb:583:in `block in load'
/opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/model.rb:526:in `map'
/opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/model.rb:526:in `load'
/opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/repository.rb:145:in `read'
/opt/local/lib/ruby/gems/1.9.1/gems/dm-core-0.10.0/lib/dm-core/collection.rb:982:in `lazy_load'
/opt/local/lib/ruby/gems/1.9.1/gems/extlib-0.9.13/lib/extlib/lazy_array.rb:459:in `size'

Cheers,
Shane.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Referenced by

Pages