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

config options to handle model namespaces #790

Merged
merged 9 commits into from May 11, 2015
Merged

Conversation

subvertallchris
Copy link
Contributor

Inspired by #753, this adds two config options:

Neo4j::Config[:module_handling]

In your app's config file:

neo4j.config.module_handling = option

option can be :demodulize, which will strip module names from the model's name using ActiveSupport's demodulize method, or a proc that will receive model.name as an arg and you can decorate it however you want. Anything else will just get ignored.

Neo4j::Config[:association_model_namespace]

In config:

neo4j.config.association_model_namespace = 'ModuleName'

This will prefix the models associations look for when model_class is omitted with whatever value you give it. It's useful if all of your models are part of the same module, just set once and it'll take care of the rest.

Examples are in specs. I need to test that it can load correctly when these options are set.

@cheerfulstoic
Copy link
Contributor

Awesome, thanks ;) Could you document in docs/Configuration.rst?

@subvertallchris
Copy link
Contributor Author

Definitely. There's still a tiny bit more work to do... Wrapping works but needs a tweak. I'll have it fixed and documented in a few mins.

@cheerfulstoic
Copy link
Contributor

👍 ;)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) to 98.35% when pulling 9c0e9cd on module_options into 59938ae on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) to 98.35% when pulling 9c0e9cd on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 98.35% when pulling ca7bb3c on module_options into 59938ae on master.

@cheerfulstoic
Copy link
Contributor

Oh, also, to generate the docs run rake docs and commit the results under docs

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) to 98.35% when pulling ca7bb3c on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) to 98.35% when pulling ca7bb3c on module_options into 59938ae on master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) to 98.35% when pulling ca7bb3c on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.11%) to 98.35% when pulling ca7bb3c on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.14%) to 98.32% when pulling 3c4bfd7 on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.13%) to 98.32% when pulling e3eb97d on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.13%) to 98.32% when pulling ddbf6f5 on module_options into 59938ae on master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.13%) to 98.32% when pulling ddbf6f5 on module_options into 59938ae on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.13%) to 98.32% when pulling ddbf6f5 on module_options into 59938ae on master.

subvertallchris added a commit that referenced this pull request May 11, 2015
config options to handle model namespaces
@subvertallchris subvertallchris merged commit d24483c into master May 11, 2015
@subvertallchris subvertallchris deleted the module_options branch May 12, 2015 03:47
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 this pull request may close these issues.

None yet

3 participants