#137 ✓hold
Andreas Ronge

Can't modify a model after it has been reloaded - Frozen Hash

Reported by Andreas Ronge | November 22nd, 2010 @ 09:46 PM

On commit 8e6ea4


jruby-1.5.5 > class Bar < Neo4j::Model
jruby-1.5.5 ?>  property :x
jruby-1.5.5 ?>  end
 => [:x] 
jruby-1.5.5 > a = Bar.new
 => #<Bar:0x1162a9c @relationships={}, @properties={}> 
jruby-1.5.5 > a.x = 42
 => 42 
jruby-1.5.5 > a.x
 => 42 
jruby-1.5.5 > a.x.class
 => Fixnum 
jruby-1.5.5 > a.reload
 => #<Bar:0x1162a9c @changed_attributes={}, @properties={}, @_java_node=nil, @relationships={}, @previously_changed={"x"=>[nil, 42]}, @_persisted=false, @_deleted=true> 
jruby-1.5.5 > a.x = 31
TypeError: can't modify frozen hash
    from ./neo4j/rails/attributes.rb:41:in `write_local_property'
    from ./neo4j/rails/attributes.rb:151:in `write_local_property_with_type_conversion'
    from ./neo4j/rails/mapping/property.rb:54:in `x='
    from (irb):28

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 ยป

Neo4j.rb is a graph database framework for JRuby.

It provides:

* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails

People watching this ticket

Pages