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

extend the definition for polimorphic relationships #589

Closed
pdipietro opened this issue Nov 19, 2014 · 7 comments
Closed

extend the definition for polimorphic relationships #589

pdipietro opened this issue Nov 19, 2014 · 7 comments
Assignees
Milestone

Comments

@pdipietro
Copy link

Hi all,
I'd need to define a polimorphic relationship.
Your suggested solution is to use

 has_many :in, :people_playing_music, model_class: Band
 has_many :out, :managed_objects, type: 'manages', model_class: false

But this is a binary solution, while I'd like to have a more fuzzy one, like

 has_many :out, :managed_objects, type: 'manages', model_class: [:Band, :Singer, :Instrument]

Do you think this could be resolved anyway?

Paolo

@pdipietro pdipietro changed the title can extend the destination of a relationship without using :any? extend the definition for polimorphic relationships Nov 19, 2014
@subvertallchris
Copy link
Contributor

That isn't an option right now but it seems totally reasonable.

@cheerfulstoic
Copy link
Contributor

See commit 11939fc

@cheerfulstoic
Copy link
Contributor

GitHub is having some trouble showing the comparison. It might be because I accidentially made the change on master first and then reverted it and based the branch on the original commit without the revision. So probably GitHub thinks that the 589_fix branch is older than master with everything that master has. Best to just look at the commit for now (see above)

@subvertallchris
Copy link
Contributor

It's cause of the China DDOS, I think. I had trouble commenting to an
issue, too.

On Sunday, March 29, 2015, Brian Underwood notifications@github.com wrote:

GitHub is having some trouble showing the comparison. It might be because
I accidentially made the change on master first and then reverted it and
based the branch on the original commit without the revision. So probably
GitHub thinks that the 589_fix branch is older than master with everything
that master has. Best to just look at the commit for now (see above)


Reply to this email directly or view it on GitHub
#589 (comment).

cheerfulstoic added a commit that referenced this issue Apr 5, 2015
@cheerfulstoic
Copy link
Contributor

Merged to master and ready for the next release

@pdipietro
Copy link
Author

In my Gemfile I've gem "neo4j", "~> 4.0"

Trying to define the following polimorphic relationship

has_one   :out, :belongs_to, model_class: [:Group, :Discussion]  

I got the error:

SyntaxError (/home/pdipietro/.rvm/gems/ruby-2.1.5/gems/neo4j-4.1.5/lib/neo4j/active_node/has_n.rb:189: syntax error, unexpected [, expecting tCONSTANT
...Node::Query::QueryProxy.new(::[:Group, :Discussion],
...  

How can I specify the correct Gem?

@cheerfulstoic
Copy link
Contributor

This is is master which means it isn't released to rubygems. If you want you can try:

gem 'neo4j', github: 'neo4jrb/neo4j'

Otherwise, it will be part of the 5.0 release which we're currently working on

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

No branches or pull requests

3 participants