ranked-model
ranked-model copied to clipboard
Add a simple spec for validating presence of an _order field.
This is the same issue as #51, but I've added a breaking test.
Basically, before_save :handle_ranking gets run only after the validation throws the error. This is because validation callbacks happen first:

Unfortunately, I'm not sure how to fix this without breaking a bunch of other specs. Maybe you can defer validations on ranking columns until handle_ranking has been run. I'm not sure.
Or run the ranking before_validation instead of before_create?
I tried exactly that. It breaks a bunch of specs, though I didn't dig in too much.
Closing this on its 10 year anniversary.