Closed walski closed 7 years ago
@take-five any idea why this is failing for AR < 4.1
Hey @walski Thanks for the report. I appreciate your PR, but I don't fully agree on proposed solution. I think it's better to remove any default orderings when building recursive query (default scope will apply to outer resulting query anyway).
Please check out this commit https://github.com/take-five/activerecord-hierarchical_query/commit/1b0e034a2cc4114dac2b16e501b0c856ab98e3ab
gem 'activerecord-hierarchical_query', github: 'take-five/activerecord-hierarchical_query', ref: '1b0e034a2c'
Please let me know if it works for you and I'll release patched version.
Hey @take-five that works for me, as well. I've tested it in our project and all specs are green :+1:
Thanks for you efforts!
@walski Version 0.1.5 has been pushed to rubygems.org
Hey,
I've been trying to use the gem for a model that uses an
order
statement in it's default scope like this:This lead to queries as:
which failed on PostgreSQL due to the
ORDER BY name ASC
part with this error:This fixes the problem by allowing to add a
reorder
statement to the child scope.