I need to put my category in alphabetical order:
@posts_categories = Admin::PostCategory.all
I need to put my category in alphabetical order:
@posts_categories = Admin::PostCategory.all
Sorting can be done this way:
@posts_categories = Admin::PostCategory.order(name: :asc)
That's if the poss_categories table has the "name" field. If not, just replace with the name of the field to use as sorting criteria.
The asc
says that the sort will be done ascending (A-Z or 0 - 10 ...)
To learn more about it, visit: link