closure_tree icon indicating copy to clipboard operation
closure_tree copied to clipboard

Ordering by an integer column that is not exclusively used for sorting is being filled with random numbers

Open khoi74 opened this issue 10 years ago • 1 comments

To give an example, I have a Comment model with a score attribute (integer) that is essentially the number of votes that Comment has received. I'm doing something like this:

class Comment
    has_closure_tree order: 'score ASC'
end

Now whenever I create a new comment, the score attribute is set to a seemingly random number (doesn't correlate with number of Comments in the DB, which I thought it might be doing). Not only that, but all the other Comments also have their score attribute set to a unique and seemingly random number.

I haven't had a chance to dig into this - but does anyone have an idea of what might be going on?

khoi74 avatar Jun 09 '15 03:06 khoi74

I don't believe using deterministic ordering with a modifier is something people have done before.

mceachen avatar Jun 09 '15 04:06 mceachen