andreasronge/neo4j — Issue #100: save fails with runtime exception instead of returning false
Author: dnagir
Created: 2011-12-14 23:12:07+00:00
State: open

http://neo4j.lighthouseapp.com/projects/15548/tickets/181-save-fails-with-runtime-exception-instead-of-returning-false

```ruby
class Posting < Neo4j::Rails::Relationship
before_validation :do_some_checks
def do_some_checks
puts "CHECK"
false
end
end

class Blog < Neo4j::Rails::Model
has_n(:posts).relationship(Posting)
end
```

if for a post, the callback chain is halted (do_some_checks returns false), then
blog.save throws a runtime exception instead of returning false.

```ruby
jruby-1.6.3 :007 > blog.save
RuntimeError: Can't save outgoing id: 2250 start_node: 8 end_node: 9
type:posts, validation errors ? #

{mkd-extraction-cf3470256621d2d8c385b15d024f714f}
lib/neo4j/rails/relationships/storage.rb:147:in `persist'

{mkd-extraction-1295e34a737a60a2b16394b8a1a3c4a2}
lib/neo4j/rails/relationships/storage.rb:143:in `persist'

{mkd-extraction-cf3470256621d2d8c385b15d024f714f}
lib/neo4j/rails/relationships/relationships.rb:8:in
`write_changed_relationships'

{mkd-extraction-b59030e1bd9ba34a49928b93e71ff68c}
lib/neo4j/rails/relationships/relationships.rb:7:in
`write_changed_relationships
```