Closed mattvague closed 5 months ago
Hi @mattvague, I'm not too sure what to do about this. It looks like you're explicit calling branch_order_rank
on this item? Perhaps you could check if the branch_order
is nil
first?
If that's not the code path then I'd be keen to know what it is to see if we can cope.
My suggestion would be to add mechanisms on your end to keep your data clean (if it has a tendency to get out of order). If you don't bypass the callbacks and ensure any existing data is fixed up before using ranked-model you should have a better time :)
No further feedback, so closing this issue.
If you have a model with
nil
as the position in the database, callingmodel. branch_order_rank
will raise an error due to invalid SQL, eg:I think I've narrowed down this issue to this method.I know that
ranked-model
attempts to always populate the column on save but it's possible if you have an existing dataset, bypass callbacks, that you could still have nil values making this an issue.Not sure what the right solution is, but I feel like this situation should be gracefully handled somehow. Happy to open a PR with a little guidance. Thanks!