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

With position

Open zlotnika opened this issue 7 years ago • 1 comments

This adds a class method

Duck.rank(:swimming_order).with_swimming_order_position

It is meant to be used when serializing a collection with its order. It sets the swimming_order_position of each item in the array. The only drawbacks are that you cannot chain queries after it (it returns an array, not an ActiveRecord object), and that it does the ordering in ruby (not SQL), and that It also won't paginate super nicely (this gem doesn't really do that anyway, so that's fine). Also, I couldn't get the tests running locally, so I didn't add any. Feel free to add some.

This should solve https://github.com/mixonic/ranked-model/issues/70, https://github.com/mixonic/ranked-model/issues/116, https://github.com/mixonic/ranked-model/issues/10

zlotnika avatar Mar 07 '17 02:03 zlotnika

@zlotnika Thanks I was lookin for this

@mixonic Any plan to accept this PR?

Liooo avatar Mar 28 '17 00:03 Liooo