Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There should be an easy way to delete a relationship via an assocation #630

Closed
cheerfulstoic opened this issue Dec 8, 2014 · 3 comments · Fixed by #632
Closed

There should be an easy way to delete a relationship via an assocation #630

cheerfulstoic opened this issue Dec 8, 2014 · 3 comments · Fixed by #632

Comments

@cheerfulstoic
Copy link
Contributor

See this stack overflow post:

http://stackoverflow.com/questions/27355400/how-to-remove-relationship-in-neo4jrb-3-0

@subvertallchris
Copy link
Contributor

If you know there's only one relationship, first_rel_to(node).destroy
works. There should probably be an all_rels_to method that returns an
enumerable, then you could to all_rels_to(node).map(&:destroy).

On Monday, December 8, 2014, Brian Underwood notifications@github.com
wrote:

See this stack overflow post:

http://stackoverflow.com/questions/27355400/how-to-remove-relationship-in-neo4jrb-3-0


Reply to this email directly or view it on GitHub
#630.

@cheerfulstoic
Copy link
Contributor Author

If there's only one it should be a has_one assocation and you should be able to just say node.assocation = nil. It's the has_many that's tricky here. In ActiveRecord you can say node.assocation.delete(other_node). ActiveRecord goes to a lot of trouble to let you use associations a lot like arrays

@subvertallchris
Copy link
Contributor

Always the voice of reason! One sec and I'll do a second PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants