Skip to content

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

Open
@khoi74

Description

@khoi74

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions