Rails override default scope ordering

If you have an ordering default scope that you’d like to override with a different ordering, you can do the following:

Change the order() method to .reorder()

This will remove all pre-existing default scope orderings and replace them with the argument found within the reorder request.

Leave a Reply

Your email address will not be published. Required fields are marked *