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

ActiveRel type checks need to respect module config #1200

Open
subvertallchris opened this issue May 15, 2016 · 1 comment
Open

ActiveRel type checks need to respect module config #1200

subvertallchris opened this issue May 15, 2016 · 1 comment

Comments

@subvertallchris
Copy link
Contributor

subvertallchris commented May 15, 2016

# Given
Neo4j::Config[:association_model_namespace] = 'Graph'
Neo4j::Config[:module_handling] = :demodulize

module Graph
  class MyRel
    include Neo4j::ActiveRel
    # Venue is namespaced as Graph::Venue to avoid conflicts with ::Venue
    from_class :Venue
    # etc
  end
end

# This should not happen

MyRel.create(graph_venue, graph_event)
NoMethodError: undefined method `mapped_label_name' for #<Class:0x007fadd3248348>

There's also an issue with rel_class in associations. I ended up having less time than I thought so couldn't get to a fix, will do it soon.

@cheerfulstoic
Copy link
Contributor

I was discussing this with @leviwilson the other day. I think that the default behavior for ActiveRel should be to demodulize and you should need to configure to include the module. After all, if you have Graph::MyRel and Foo::MyRel, it doesn't matter if you have multiple relationships that have the same type of MY_REL (or my_rel, depending on your settings). Also it's just weird if you were to do GRAPH_MY_REL / FOO_MY_REL by default. The class name is almost always what's describing the relationship type.

@leviwilson ran into this originally because it was trying to do Graph::MyRel as the relationship type without using backticks and giving an error (perhaps that's what you got as well).

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

2 participants