ranked-model icon indicating copy to clipboard operation
ranked-model copied to clipboard

Add a simple spec for validating presence of an _order field.

Open yaymukund opened this issue 11 years ago • 3 comments

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:

screen shot 2014-03-02 at 11 59 47 pm

yaymukund avatar Mar 03 '14 05:03 yaymukund

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.

yaymukund avatar Mar 03 '14 05:03 yaymukund

Or run the ranking before_validation instead of before_create?

mixonic avatar Mar 03 '14 23:03 mixonic

I tried exactly that. It breaks a bunch of specs, though I didn't dig in too much.

yaymukund avatar Mar 03 '14 23:03 yaymukund

Closing this on its 10 year anniversary.

brendon avatar Jun 04 '24 04:06 brendon