andreasronge/neo4j — pull request #133 by dnagir (2012-01-16 04:09:46+00:00)
Title: Trying to update to Rails 3.2

Gave up trying to fix #131. This is what I ended up so far.

Sending a PR so that we can work on it further.

But I give this it today.

Even after I updated the `inhertiable_attributes` to use the internal stuff, most of the specs failed. The failures mostly look like:

```
> b/rspec spec/rails/property_spec.rb:58
Run options:
include {:locations=>{"./spec/rails/property_spec.rb"=>[58]}}
exclude {:identity_map=>true, :edition=>#}
F

Failures:

1) hash has a unique hash for persisted models
Failure/Error: x = UniqueHashModel.create
NoMethodError:
undefined method `has_key?' for nil:NilClass
# ./spec/../lib/neo4j/rails/attributes.rb:204:in `property?'
# ./spec/../lib/neo4j/rails/attributes.rb:241:in `respond_to?'
# ./spec/../lib/neo4j/rails/callbacks.rb:47:in `initialize_with_callbacks'
# ./spec/../lib/neo4j/rails/persistence.rb:112:in `create'
# ./spec/rails/property_spec.rb:59:in `(root)'

Finished in 0.748 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/rails/property_spec.rb:58 # hash has a unique hash for persisted models
```

Which basically means that `@properties` is not set initially.
The reason for that is that `initialize_with_callbacks` on the model is executed BEFORE the `initialize` method (thus `reset_attrubites` initialising `@properties` isn't called yet).

I'm not sure what the exact reason for the behaviour is, but it may be a breaking change in the ActiveSupport, a bug or we are using it incorrectly (which I doubt a lot).

@andreasronge, any thought?