andreasronge/neo4j — pull request #373 by subvertallchris (2014-07-11 04:10:04+00:00)
Title: Before/after relationship callbacks, QuickQuery updates

In this pull request:

**Callbacks for declared relationships!**

```ruby
has_n(:lessons, before: :before_callback, after: :after_callback)
has_one(:teacher, before: :before_callback, after: :after_callback).to(Teacher)
def before_callback(from, to)
#do something
end

def after_callback(from, to)
# do something
end
```

Pretty easy. If before explicitly returns `false`, the relationship will not be created. Methods will be passed the from and to nodes, so it's easy to check or set additional properties. Works great. I'll put notes in the wiki later tonight or tomorrow.

**QuickQuery updates**

Improved performance by using a sane method of returning objects. Once Core::Query supports distinct pluck, I'll switch it over to use that. I also boosted the test coverage.