martenframework / marten

The pragmatic web framework.
https://martenframework.com
MIT License
405 stars 23 forks source link

Make it possible to retrieve all records in a specific order from model class directly #126

Closed ellmetha closed 10 months ago

ellmetha commented 10 months ago

Description

Presently, it is possible to order model records by calling the ::all method on a specific model class and then the #order method on the obtained query set. Let's make this process simpler by adding an ::order method to model classes.

That way, it would become possible to do:

User.order(:first_name, :last_name) # Get all User records ordered by first name first and then by last name