I have model (X) using acts_as_tree, I want that model to continue using acts_as_tree. After adding ancestry to my Gemfile (for use in a different model (Y)), ancestry is now being called instead of acts_as_tree in X and failing my tests thusly:
undefined method `ancestry' for X
It appears that the following code is not working as expected:
alias_method :acts_as_tree, :has_ancestry
I also have this issue. The thing is that because you never know the load order of a plugin that adds the acts_as_tree method. Because of this, using respond_to?(:acts_as_tree) will probably fail to detect such plugins/gems.
I forked the rep and added a check for the ActsAsTree module instead. This fixes the problem only if you're using a plugin that defines the module ActsAsTree. You can use my version by specifying [gem 'ancestry', :git => 'git://github.com/jims/ancestry.git'] in your gemfile.
I'll add a pull request if the author wants to incorporate these changes :>
Fix by Jims was released in Ancestry 1.2.4. Thank you!
I still have problems with this issue. We are using the official acts_as_tree plugin from https://github.com/rails/acts_as_tree
This version doesn't define an ActsAsTree module, so the patch doesn't work. Maybe it would be better to let the developer interface these aliases via an initializer or macro configuration option? As an example I'd like to choose not to alias the acts_as_tree method at all, because I don't care about ancestry downwards compatibility.
has_ancestry :alias_acts_as_tree => false
hotsen, see the notice on that repository:
NOTICE: official repository moved to https://github.com/amerine/acts_as_tree
See if that fixes the problem.
No sorry, it's the problem same there.