Skip to content

Prevent name collision with other gems: allowing the use of has_closure_treemethod besides acts_as_tree #130

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

Merged
merged 1 commit into from
Nov 14, 2014

Conversation

eturino
Copy link
Contributor

@eturino eturino commented Oct 14, 2014

Scenario: one of your dependencies uses other gem like Ancestry, while you want to use this gem for its multiple benefits. Even if that dependency uses the has_ancestry method instead of the acts_as_tree method, it will overwrite ClosureTree's acts_as_tree, render it useless. If we can still use another method like has_closure_tree, we can still work with this.

This way, the user can choose between using has_closure_tree (more intention revealing name in terms of what tool we want to use, IMO) or the generic acts_as_tree as before.

I changed one of the models of the specs to use the has_closure_tree method while leaving the rest using the acts_as_tree method to ensure that everything keeps working as expected.

@eturino eturino changed the title Prevent name collision with other gems: allowing the use of has_closure_tree beside method besides acts_as_tree Prevent name collision with other gems: allowing the use of has_closure_treemethod besides acts_as_tree Oct 14, 2014
@mceachen
Copy link
Collaborator

LGTM. We may want to add a caveat that other hierarchical gems won't place
nice against the same model. That might not be obvious to all casual
observers.

BTW, what are you missing from ancestry?
On Oct 14, 2014 6:53 AM, "Eduardo Turiño" [email protected] wrote:

Scenario: one of your dependencies uses other gem like Ancestry, while you
want to use this gem for its multiple benefits. Even if that dependency
uses the has_ancestry method instead of the acts_as_tree method, it will
overwrite ClosureTree's acts_as_tree, render it useless. If we can still
use another method like has_closure_tree, we can still work with this.

This way, the user can choose between using has_closure_tree (more
intention revealing name in terms of what tool we want to use, IMO) or the
generic acts_as_tree as before.

I changed one of the models of the specs to use the has_closure_tree
method while leaving the rest using the acts_as_tree method to ensure

that everything keeps working as expected.

You can merge this Pull Request by running

git pull https://github.com/eturino/closure_tree has_closure_tree

Or view, comment on, or merge it at:

#130
Commit Summary

  • Prevent name collision with other gems: allowing the use of
    has_closure_tree beside method besides acts_as_tree

File Changes

Patch Links:


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

@seuros
Copy link
Member

seuros commented Oct 14, 2014

BTW, what are you missing from ancestry?

I think the gem he is using depend on ancestry.

@kubum
Copy link

kubum commented Oct 14, 2014

looks good 👍

@eturino
Copy link
Contributor Author

eturino commented Oct 15, 2014

Indeed that is the case: a dependency of my app uses ancestry.

@eturino
Copy link
Contributor Author

eturino commented Oct 15, 2014

@mceachen I updated the README doc.

@eturino
Copy link
Contributor Author

eturino commented Nov 2, 2014

@mceachen increased language strength in the warning section of the README as requested :)

@eturino
Copy link
Contributor Author

eturino commented Nov 13, 2014

@mceachen anything else I can do, or is it ready to be merged? :)

@seuros
Copy link
Member

seuros commented Nov 13, 2014

Please squash your commits.

…ure_tree` beside method besides `acts_as_tree`
@eturino
Copy link
Contributor Author

eturino commented Nov 14, 2014

@seuros squashed

seuros added a commit that referenced this pull request Nov 14, 2014
Prevent name collision with other gems: allowing the use of `has_closure_tree`method besides `acts_as_tree`
@seuros seuros merged commit d543e16 into ClosureTree:master Nov 14, 2014
@seuros
Copy link
Member

seuros commented Nov 14, 2014

@eturino Thank you 💚

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.

4 participants