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

NumericDeterministicOrdering methods not available when specifying order without using a string #116

Closed
gertfj opened this issue Aug 8, 2014 · 1 comment

Comments

@gertfj
Copy link

gertfj commented Aug 8, 2014

Hi

it seems that "order" isn't enabled when I specify my acts_as_tree statement like this:

acts_as_tree order: { position: :asc }, dependent: :destroy

If I specify it using a string for ordering then everything works fine:

acts_as_tree order: "position ASC", dependent: :destroy

Please note that the actual ordering works fine in both cases so the problem is likely in the order_is_numeric? method that controls the include of ClosureTree::NumericDeterministicOrdering.

Thanks for building a great gem !

@mceachen
Copy link
Collaborator

mceachen commented Aug 9, 2014

You're correct, you are fighting order_is_numeric?.

I think it's working as I wrote it, though—if the order is a simple string or symbol, and the column exists, and it's an integer, then you get the numeric ordering functionality.

I really wanted to constrain the environment that I support for numeric ordering, because it's already complicated as it is, and was concerned about the implementation complexity impact for adding support for order modifiers—it's already pretty hairy code (check out preordered!).

If you feel like it's a reasonable addition to the gem, I'm happy to reopen this and help you with a pull request.

@mceachen mceachen closed this as completed Aug 9, 2014
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